- java.lang.Object
-
- org.apache.logging.log4j.util.Constants
-
@InternalApi public final class Constants extends 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 Object[]
EMPTY_OBJECT_ARRAY
The empty array.static boolean
ENABLE_THREADLOCALS
Deprecated, for removal: This API element is subject to removal in a future version.static boolean
IS_WEB_APP
Deprecated, for removal: This API element is subject to removal in a future version.useisWebApp()
static int
JAVA_MAJOR_VERSION
static int
MAX_REUSABLE_MESSAGE_SIZE
Maximum size of the StringBuilders used in RingBuffer LogEvents to store the contents of reusable Messages.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static boolean
isThreadLocalsEnabled()
Kill switch for object pooling in ThreadLocals that enables much of the LOG4J2-1270 no-GC behaviour.static boolean
isWebApp()
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 void
resetThreadLocalsEnabled()
static void
resetWebApp()
static void
setThreadLocalsEnabled(boolean enabled)
static void
setWebApp(boolean webApp)
-
-
-
Field Detail
-
IS_WEB_APP
@Deprecated(since="3.0.0", forRemoval=true) public static final boolean IS_WEB_APP
Deprecated, for removal: This API element is subject to removal in a future version.useisWebApp()
-
ENABLE_THREADLOCALS
@Deprecated(since="3.0.0", forRemoval=true) public static final boolean ENABLE_THREADLOCALS
Deprecated, for removal: This API element is subject to removal in a future version.
-
JAVA_MAJOR_VERSION
public static final int 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 518, which allows the StringBuilder to resize three times from its initial size. Users can override with system property .
- Since:
- 2.9
-
EMPTY_OBJECT_ARRAY
public static final Object[] EMPTY_OBJECT_ARRAY
The empty array.
-
EMPTY_BYTE_ARRAY
public static final byte[] EMPTY_BYTE_ARRAY
The empty array.
-
-
Method Detail
-
isWebApp
public static boolean isWebApp()
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.
-
setWebApp
public static void setWebApp(boolean webApp)
-
resetWebApp
public static void resetWebApp()
-
isThreadLocalsEnabled
public static boolean isThreadLocalsEnabled()
Kill switch for object pooling in ThreadLocals that enables much of the LOG4J2-1270 no-GC behaviour.True
for non-isWebApp()
web apps}, disable by setting system property "log4j2.enable.threadlocals" to "false".
-
setThreadLocalsEnabled
public static void setThreadLocalsEnabled(boolean enabled)
-
resetThreadLocalsEnabled
public static void resetThreadLocalsEnabled()
-
-