Top Description Fields Constructors Methods
org.apache.logging.log4j.util

public final Class Constants

extends Object
Class Inheritance

Log4j API Constants.
Since
2.6.2

Field Summary

Modifier and TypeField and Description
public static final byte[]
EMPTY_BYTE_ARRAY

The empty array.

public static final Object[]
EMPTY_OBJECT_ARRAY

The empty array.

public static final boolean
ENABLE_THREADLOCALS

Kill switch for object pooling in ThreadLocals that enables much of the LOG4J2-1270 no-GC behaviour.

public static final boolean
IS_WEB_APP

true if we think we are running in a web container, based on the boolean value of system property "log4j2.is.webapp", or (if this system property is not set) whether the javax.servlet.Servlet class is present in the classpath.

public static final int
JAVA_MAJOR_VERSION

Java major version.

public static final String
LOG4J2_DEBUG

Name of the system property that will turn on TRACE level internal log4j2 status logging.

public static final int
MAX_REUSABLE_MESSAGE_SIZE

Maximum size of the StringBuilders used in RingBuffer LogEvents to store the contents of reusable Messages.

Constructor Summary

AccessConstructor and Description
private
Constants()

Prevent class instantiation.

Method Summary

Modifier and TypeMethod and Description
private static int
pack-priv static int
getMajorVersion(final String version)

private static boolean

Returns:

true if the class could be found or false otherwise.
isClassAvailable
(final String
The class name.
className
)

Determines if a named Class can be loaded or not.

private static int
size(final String property, final int defaultValue)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

EMPTY_BYTE_ARRAYback to summary
public static final byte[] EMPTY_BYTE_ARRAY

The empty array.

EMPTY_OBJECT_ARRAYback to summary
public static final Object[] EMPTY_OBJECT_ARRAY

The empty array.

ENABLE_THREADLOCALSback to summary
public static final boolean ENABLE_THREADLOCALS

Kill switch for object pooling in ThreadLocals that enables much of the LOG4J2-1270 no-GC behaviour.

True for non-web apps, disable by setting system property "log4j2.enable.threadlocals" to "false".

IS_WEB_APPback to summary
public static final boolean IS_WEB_APP

true if we think we are running in a web container, based on the boolean value of system property "log4j2.is.webapp", or (if this system property is not set) whether the javax.servlet.Servlet class is present in the classpath.

JAVA_MAJOR_VERSIONback to summary
public static final int JAVA_MAJOR_VERSION

Java major version.

LOG4J2_DEBUGback to summary
public static final String LOG4J2_DEBUG

Name of the system property that will turn on TRACE level internal log4j2 status logging.

If system property 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 property org.apache.logging.log4j.simplelog.StatusLogger.level.

MAX_REUSABLE_MESSAGE_SIZEback to summary
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.9

Constructor Detail

Constantsback to summary
private Constants()

Prevent class instantiation.

Method Detail

getMajorVersionback to summary
private static int getMajorVersion()
getMajorVersionback to summary
pack-priv static int getMajorVersion(final String version)
isClassAvailableback to summary
private static boolean isClassAvailable(final String className)

Determines if a named Class can be loaded or not.

Parameters
className:String

The class name.

Returns:boolean

true if the class could be found or false otherwise.

sizeback to summary
private static int size(final String property, final int defaultValue)