Package org.apache.logging.log4j.util
Class Constants
- java.lang.Object
-
- org.apache.logging.log4j.util.Constants
-
public final class Constants extends java.lang.Object
Log4j API Constants.- Since:
- 2.6.2
-
-
Field Summary
Fields Modifier and Type Field Description static byte[]
EMPTY_BYTE_ARRAY
The empty array.static java.lang.Object[]
EMPTY_OBJECT_ARRAY
The empty array.static boolean
ENABLE_THREADLOCALS
Kill switch for object pooling in ThreadLocals that enables much of the LOG4J2-1270 no-GC behaviour.static 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 thejavax.servlet.Servlet
class is present in the classpath.static int
JAVA_MAJOR_VERSION
Java major version.static java.lang.String
LOG4J2_DEBUG
Name of the system property that will turn on TRACE level internal log4j2 status logging.static int
MAX_REUSABLE_MESSAGE_SIZE
Maximum size of the StringBuilders used in RingBuffer LogEvents to store the contents of reusable Messages.
-
Constructor Summary
Constructors Modifier Constructor Description private
Constants()
Prevent class instantiation.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description private static int
getMajorVersion()
(package private) static int
getMajorVersion(java.lang.String version)
private static boolean
isClassAvailable(java.lang.String className)
Determines if a named Class can be loaded or not.private static int
size(java.lang.String property, int defaultValue)
-
-
-
Field Detail
-
IS_WEB_APP
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 thejavax.servlet.Servlet
class 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.True
for non-web apps
, disable by setting system property "log4j2.enable.threadlocals" to "false".
-
JAVA_MAJOR_VERSION
public static final int JAVA_MAJOR_VERSION
Java major version.
-
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 , which allows the StringBuilder to resize three times from its initial size. Users can override with system property "log4j.maxReusableMsgSize".
- Since:
- 2.9
-
LOG4J2_DEBUG
public static final java.lang.String 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
.- See Also:
- Constant Field Values
-
EMPTY_OBJECT_ARRAY
public static final java.lang.Object[] EMPTY_OBJECT_ARRAY
The empty array.
-
EMPTY_BYTE_ARRAY
public static final byte[] EMPTY_BYTE_ARRAY
The empty array.
-
-
Method Detail
-
size
private static int size(java.lang.String property, int defaultValue)
-
isClassAvailable
private static boolean isClassAvailable(java.lang.String className)
Determines if a named Class can be loaded or not.- Parameters:
className
- The class name.- Returns:
true
if the class could be found orfalse
otherwise.
-
getMajorVersion
private static int getMajorVersion()
-
getMajorVersion
static int getMajorVersion(java.lang.String version)
-
-