Class Constants
- Since:
- 2.6.2
-
Field Summary
Modifier and TypeFieldDescriptionstatic final byte[]
The empty array.static final Object[]
The empty array.static final boolean
Specifies whether Log4j can bind non-JRE types toThreadLocal
sstatic final boolean
Specifies whether Log4j is used in a servlet containerstatic final int
Java major version.static final String
Name of the system property that will turn on TRACE level internal log4j2 status logging.static final int
Maximum size of the StringBuilders used in RingBuffer LogEvents to store the contents of reusable Messages. -
Method Summary
-
Field Details
-
IS_WEB_APP
public static final boolean IS_WEB_APPSpecifies whether Log4j is used in a servlet containerIf
true
Log4j disables the features, which are incompatible with a typical servlet application:- It disables the usage of
ThreadLocal
s for object pooling (unless the user has explicitly provided aENABLE_THREADLOCALS
property) - It uses a web-application safe implementation of
ThreadContextMap
(seeProvider.getThreadContextMap()
), - It disables the shutdown hook,
- It uses the caller thread to send JMX notifications.
The value of this constant depends upon the presence of the Servlet API on the classpath and can be overridden using the
"log4j2.isWebapp"
system property. - It disables the usage of
-
ENABLE_THREADLOCALS
public static final boolean ENABLE_THREADLOCALSSpecifies whether Log4j can bind non-JRE types toThreadLocal
sThe value of this constant is
true
, unless Log4j is running in a servlet container (cf.IS_WEB_APP
). Use the"log4j2.enableThreadlocals
system property to override its value.In order to enable the garbage-free behavior described in LOG4J2-1270, this constant must be
true
.Warning: This setting does not disable all thread locals. It only disables those thread locals that can cause a classloader memory leak.
-
JAVA_MAJOR_VERSION
public static final int JAVA_MAJOR_VERSIONJava major version.- Since:
- 2.8.1
-
MAX_REUSABLE_MESSAGE_SIZE
public static final int MAX_REUSABLE_MESSAGE_SIZEMaximum size of the StringBuilders used in RingBuffer LogEvents to store the contents of reusable Messages. After a large message has been delivered to the appenders, the StringBuilder is trimmed to this size.The default value is 518, which allows the StringBuilder to resize three times from its initial size. Users can override with system property "log4j.maxReusableMsgSize".
- Since:
- 2.9.0
-
LOG4J2_DEBUG
Name of the system property that will turn on TRACE level internal log4j2 status logging.If system property "log4j2.debug" is either defined empty or its value equals to
true
(ignoring case), all internal log4j2 logging will be printed to the console. The presence of this system property overrides any value set in the configuration's<Configuration status="<level>" ...>
status attribute, as well as any value set for system propertyorg.apache.logging.log4j.simplelog.StatusLogger.level
.- Since:
- 2.9.0
- See Also:
-
EMPTY_OBJECT_ARRAY
The empty array.- Since:
- 2.15.0
-
EMPTY_BYTE_ARRAY
public static final byte[] EMPTY_BYTE_ARRAYThe empty array.- Since:
- 2.15.0
-