Class Constants
- java.lang.Object
-
- org.apache.logging.log4j.core.util.Constants
-
public final class Constants extends java.lang.ObjectLog4j Constants.
-
-
Field Summary
Fields Modifier and Type Field Description static booleanENABLE_DIRECT_ENCODERSKill switch for garbage-free Layout behaviour that encodes LogEvents directly intoByteBufferDestinations without creating intermediate temporary Objects.static booleanENABLE_THREADLOCALSKill switch for object pooling in ThreadLocals that enables much of the LOG4J2-1270 no-GC behaviour.static intENCODER_BYTE_BUFFER_SIZEDefault size of ByteBuffers used to encode LogEvents without allocating temporary objects.static intENCODER_CHAR_BUFFER_SIZESize of CharBuffers used by text encoders.static booleanFORMAT_MESSAGES_IN_BACKGROUNDSupports user request LOG4J2-898 to have the option to format a message in the background thread.static booleanFORMAT_MESSAGES_PATTERN_DISABLE_LOOKUPSDeprecated.no longer used, lookups are only used when%m{lookups}is specifiedstatic intINITIAL_REUSABLE_MESSAGE_SIZEInitial StringBuilder size used in RingBuffer LogEvents to store the contents of reusable Messages.static booleanIS_WEB_APPtrueif we think we are running in a web container, based on the boolean value of system property "log4j2.isWebapp", or (if this system property is not set) whether thejavax.servlet.Servletclass is present in the classpath.static java.lang.StringJNDI_CONTEXT_NAMEJNDI context name string literal.static java.lang.StringLOG4J_CONTEXT_SELECTORName of the system property to use to identify the ContextSelector Class.static java.lang.StringLOG4J_DEFAULT_STATUS_LEVELDeprecated.since 2.24.0 useStatusLogger.DEFAULT_STATUS_LISTENER_LEVELinstead.static java.lang.StringLOG4J_LOG_EVENT_FACTORYName of the system property to use to identify the LogEvent factory.static intMAX_REUSABLE_MESSAGE_SIZEMaximum size of the StringBuilders used in RingBuffer LogEvents to store the contents of reusable Messages.static intMILLIS_IN_SECONDSNumber of milliseconds in a second.static java.lang.StringSCRIPT_LANGUAGESControl which script languages are allowed, if any.
-
Constructor Summary
Constructors Modifier Constructor Description privateConstants()Prevent class instantiation.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description private static intsize(java.lang.String property, int defaultValue)
-
-
-
Field Detail
-
LOG4J_LOG_EVENT_FACTORY
public static final java.lang.String LOG4J_LOG_EVENT_FACTORY
Name of the system property to use to identify the LogEvent factory.- See Also:
- Constant Field Values
-
LOG4J_CONTEXT_SELECTOR
public static final java.lang.String LOG4J_CONTEXT_SELECTOR
Name of the system property to use to identify the ContextSelector Class.- See Also:
- Constant Field Values
-
LOG4J_DEFAULT_STATUS_LEVEL
@Deprecated public static final java.lang.String LOG4J_DEFAULT_STATUS_LEVEL
Deprecated.since 2.24.0 useStatusLogger.DEFAULT_STATUS_LISTENER_LEVELinstead.Property name for the default status (internal log4j logging) level to use if not specified in configuration.- See Also:
- Constant Field Values
-
JNDI_CONTEXT_NAME
public static final java.lang.String JNDI_CONTEXT_NAME
JNDI context name string literal.- See Also:
- Constant Field Values
-
SCRIPT_LANGUAGES
public static final java.lang.String SCRIPT_LANGUAGES
Control which script languages are allowed, if any.- See Also:
- Constant Field Values
-
MILLIS_IN_SECONDS
public static final int MILLIS_IN_SECONDS
Number of milliseconds in a second.- See Also:
- Constant Field Values
-
FORMAT_MESSAGES_IN_BACKGROUND
public static final boolean FORMAT_MESSAGES_IN_BACKGROUND
Supports user request LOG4J2-898 to have the option to format a message in the background thread.
-
FORMAT_MESSAGES_PATTERN_DISABLE_LOOKUPS
@Deprecated public static final boolean FORMAT_MESSAGES_PATTERN_DISABLE_LOOKUPS
Deprecated.no longer used, lookups are only used when%m{lookups}is specifiedLOG4J2-3198 property which used to globally opt out of lookups in pattern layout message text, however this is the default and this property is no longer read. Deprecated in 2.15.- Since:
- 2.10
-
IS_WEB_APP
public static final boolean IS_WEB_APP
trueif we think we are running in a web container, based on the boolean value of system property "log4j2.isWebapp", or (if this system property is not set) whether thejavax.servlet.Servletclass is present in the classpath.
-
ENABLE_THREADLOCALS
public static final boolean ENABLE_THREADLOCALS
Kill switch for object pooling in ThreadLocals that enables much of the LOG4J2-1270 no-GC behaviour.Truefor non-web apps, disable by setting system property "log4j2.enable.threadlocals" to "false".- Since:
- 2.6
-
ENABLE_DIRECT_ENCODERS
public static final boolean ENABLE_DIRECT_ENCODERS
Kill switch for garbage-free Layout behaviour that encodes LogEvents directly intoByteBufferDestinations without creating intermediate temporary Objects.This constant is
trueby default, but can be disabled using the"log4j2.enableDirectEncoders"system property.- Since:
- 2.6
-
INITIAL_REUSABLE_MESSAGE_SIZE
public static final int INITIAL_REUSABLE_MESSAGE_SIZE
Initial StringBuilder size used in RingBuffer LogEvents to store the contents of reusable Messages.The default value is 128, users can override with system property "log4j.initialReusableMsgSize".
- Since:
- 2.6
-
MAX_REUSABLE_MESSAGE_SIZE
public static final int MAX_REUSABLE_MESSAGE_SIZE
Maximum 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.6
-
ENCODER_CHAR_BUFFER_SIZE
public static final int ENCODER_CHAR_BUFFER_SIZE
Size of CharBuffers used by text encoders.The default value is 2048, users can override with system property "log4j.encoder.charBufferSize".
- Since:
- 2.6
-
ENCODER_BYTE_BUFFER_SIZE
public static final int ENCODER_BYTE_BUFFER_SIZE
Default size of ByteBuffers used to encode LogEvents without allocating temporary objects.The default value is 8192, users can override with system property "log4j.encoder.byteBufferSize".
- Since:
- 2.6
- See Also:
ByteBufferDestination
-
-