Overview | Library | Tag | Help
| FRAMES NO FRAMES

## Log4j 2 Tag Library
Tag setLogger

Sets the default Logger to use for the rest of this JSP's execution OR exports an org.apache.logging.log4j.Logger instance as the specified EL variable. The "value" attribute specifies either the String name of a Logger to create or an actual Logger instance. By default, Loggers are constructed and assigned the standard org.apache.logging.log4j.message.ParameterizedMessageFactory. The optional "factory" attribute can be used to override the default message factory.

Example:

    <log:logger value="com.foo.bar" />
    <log:logger value="com.bar.foo" var="myLogger" />
    <log:debug message="This should log with com.foo.bar." />
    <log:debug logger="${myLogger}" message="This should log with com.bar.foo." />

Tag Information
Tag Class | org.apache.logging.log4j.taglib.SetLoggerTag
TagExtraInfo Class | None
Body Content | empty
Display Name | None

Attributes
Name | Required | Request-time | Type | Description
logger | true | true | `java.lang.Object` | The name or instance of the Logger to set as the JSP's default Logger or the name of the Logger to export as the specified EL variable.
factory | false | true | `org.apache.logging.log4j.message.MessageFactory` | Specify this optional tag to provide a message factory other than the default ParameterizedMessageFactory message factory to use for the Logger. If the Logger has already been created with a different message factory, this will be ignored. Using this attribute makes no sense if the "value" attribute's value is an actual Logger instance, since its message factory cannot be changed.
var | false | false | `java.lang.String` | The optional name of the EL variable to export this Logger as. Using this attribute makes no sense if the "value" attribute's value is an actual Logger instance. That would result in an existing Logger on the scope being re-added to the scope.
scope | false | false | `java.lang.String` | Either "page," "request," "session," or "application," the optional scope that the EL variable should be exported to (defaults to "page").

Variables
| No Variables Defined.

Overview | Library | Tag | Help
| FRAMES NO FRAMES

Output Generated by Tag Library Documentation Generator. Java, JSP, and JavaServer Pages are trademarks or registered trademarks of Sun Microsystems, Inc. in the US and other countries. Copyright 2002-4 Sun Microsystems, Inc. 4150 Network Circle Santa Clara, CA 95054, U.S.A. All Rights Reserved.