[ https://issues.apache.org/jira/browse/LOG4J2-2816?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17082432#comment-17082432 ]
Denis Orlov commented on LOG4J2-2816: ------------------------------------- Our log4j2.component.properties: {code} # All properties which can be set via System Properties (will have more priority) or here # https://logging.apache.org/log4j/2.x/manual/configuration.html -> System Properties # Path to an XML or JSON Log4j 2 configuration file. May also contain a comma separated list of configuration file names. # log4j.configurationFile= # The name of the class that implements the MergeStrategy interface. # If not specified DefaultMergeStrategy will be used when creating a CompositeConfiguration.. # log4j.mergeFactory= # Creates the LoggerContexts. An application can have one or more active LoggerContexts depending on the circumstances. # See Log Separation for more details. Available context selector implementation classes: # org.apache.logging.log4j.core.async .AsyncLoggerContextSelector - makes all loggers asynchronous. # org.apache.logging.log4j.core.selector .BasicContextSelector - creates a single shared LoggerContext. # org.apache.logging.log4j.core.selector .ClassLoaderContextSelector - separate LoggerContexts for each web application. # org.apache.logging.log4j.core.selector .JndiContextSelector - use JNDI to locate each web application's LoggerContext. # org.apache.logging.log4j.core.osgi .BundleContextSelector - separate LoggerContexts for each OSGi bundle. # Default: ClassLoaderContextSelector Log4jContextSelector=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector # Factory class used by LoggerConfig to create LogEvent instances. (Ignored when the AsyncLoggerContextSelector is used.) # Log4jLogEventFactory=org.apache.logging.log4j.core.impl .DefaultLogEventFactory # Factory class used by LogManager to bootstrap the logging implementation. # The core jar provides org.apache.logging.log4j.core.impl.Log4jContextFactory. # log4j2.loggerContextFactory=org.apache.logging.log4j.simple .SimpleLoggerContextFactory # Fully specified class name of a class extending org.apache.logging.log4j.core.config.ConfigurationFactory. # If specified, an instance of this class is added to the list of configuration factories. # log4j.configurationFactory # Overrides the global flag for whether or not a shutdown hook should be used to stop a LoggerContext. # By default, this is enabled and can be disabled on a per-configuration basis. # When running with the log4j-web module, this is automatically disabled. # log4j.shutdownHookEnabled=true # Fully specified class name of a class implementing ShutdownCallbackRegistry. # If specified, an instance of this class is used instead of DefaultShutdownCallbackRegistry. # The specified class must have a default constructor. # log4j.shutdownCallbackRegistry=org.apache.logging.log4j.core.util.DefaultShutdownCallbackRegistry # Implementation of the org.apache.logging.log4j.core.util.Clock interface that is used for timestamping the log events. # By default, System.currentTimeMillis is called on every log event. # You can also specify a fully qualified class name of a custom class that implements the Clock interface. # log4j.Clock=SystemClock # Log level of the default configuration. The default configuration is used if the ConfigurationFactory could # not successfully create a configuration (e.g. no log4j2.xml file was found). # org.apache.logging.log4j.level=ERROR # If true, the ThreadContext stack and map are disabled. (May be ignored if a custom ThreadContext map is specified.) # Default: false disableThreadContext=true # If true, the ThreadContext stack is disabled. # Default: false disableThreadContextStack=true # If true, the ThreadContext map is disabled. (May be ignored if a custom ThreadContext map is specified.) # Default: false disableThreadContextMap=true # Fully specified class name of a custom ThreadContextMap implementation class. # log4j2.threadContextMap # If true use a InheritableThreadLocal to implement the ThreadContext map. Otherwise, use a plain ThreadLocal. # (May be ignored if a custom ThreadContext map is specified.) # isThreadContextMapInheritable=false # Fully specified class name of a custom ContextDataInjector implementation class. # log4j2.ContextDataInjector # Specify "true" to make the ThreadContext map garbage-free. # Default: false log4j2.garbagefree.threadContextMap=true # If true, Log4j configuration objects like LoggerContexts, Appenders, Loggers, etc. # will not be instrumented with MBeans and cannot be remotely monitored and managed. # log4j2.disable.jmx=false # If true, log4j's JMX notifications are sent from a separate background thread, # otherwise they are sent from the caller thread. If system property log4j2.is.webapp is true or the # javax.servlet.Servlet class is on the classpath, the default behaviour is to use the caller # thread to send JMX notifications. # Default: false # log4j2.jmx.notify.async # If true, the ConsoleAppender will not try to use the Jansi output stream on Windows. # Default: false # log4j.skipJansi # If true, classes are only loaded with the default class loader. # Otherwise, an attempt is made to load classes with the current thread's context class loader # before falling back to the default class loader. # Default: false # log4j.ignoreTCL # System property that may be used to seed the UUID generation with an integer value. # Default: 0 # org.apache.logging.log4j.uuidSequence # If true, the full ThreadContext map is included in each SimpleLogger log message. # Default: false # org.apache.logging.log4j.simplelog.showContextMap # If true, the logger name is included in each SimpleLogger log message. # Default: false # org.apache.logging.log4j.simplelog.showlogname # If true, only the last component of a logger name is included in SimpleLogger log messages. # (E.g., if the logger name is "mycompany.myproject.mycomponent", only "mycomponent" is logged. # Default: true # org.apache.logging.log4j.simplelog.showShortLogname # If true, SimpleLogger log messages contain timestamp information. # Default: false # org.apache.logging.log4j.simplelog.showdatetime # Date-time format to use. Ignored if org.apache.logging.log4j.simplelog.showdatetime is false. # Default: "yyyy/MM/dd HH:mm:ss:SSS zzz" # org.apache.logging.log4j.simplelog.dateTimeFormat # "system.err" (case-insensitive) logs to System.err, "system.out" (case-insensitive) logs to System.out, # any other value is interpreted as a file name to save SimpleLogger messages to. # Default: system.err # org.apache.logging.logj.simplelog.logFile # Default level for new SimpleLogger instances. # Default: ERROR # org.apache.logging.log4j.simplelog.level # Log level for a the SimpleLogger instance with the specified name. # Default: SimpleLogger default log level # org.apache.logging.log4j.simplelog.<loggerName>level # This property is used to control the initial StatusLogger level, and can be overridden in code by calling # StatusLogger.getLogger().setLevel(someLevel). Note that the StatusLogger level is only used to determine the status # log output level until a listener is registered. In practice, a listener is registered when a configuration is found, # and from that point onwards, status messages are only sent to the listeners (depending on their statusLevel). # Default: ERROR # org.apache.logging.log4j.simplelog.StatusLogger.level # The StatusLogger logs events that occur in the logging system to the console. During configuration, # AbstractConfiguration registers a StatusConsoleListener with the StatusLogger that may redirect status log events # from the default console output to a file. The listener also supports fine-grained filtering. This system property # specifies the default status log level for the listener to use if the configuration does not specify a status level. # # Note: this property is used by the log4j-core implementation only after a configuration file has been found. # Default: ERROR # Log4jDefaultStatusLevel # The initial "listenersLevel" of the StatusLogger. If StatusLogger listeners are added, the "listenerLevel" is changed # to that of the most verbose listener. If any listeners are registered, the listenerLevel is used to quickly determine # if an interested listener exists. # # By default, StatusLogger listeners are added when a configuration is found and by the JMX StatusLoggerAdmin MBean. # For example, if a configuration contains <Configuration status="trace">, a listener with statusLevel TRACE is # registered and the StatusLogger listenerLevel is set to TRACE, resulting in verbose status messages displayed on # the console. # # If no listeners are registered, the listenersLevel is not used, and the StatusLogger output level is determined by # StatusLogger.getLogger().getLevel() (see property org.apache.logging.log4j.simplelog .StatusLogger.level). # Default: WARN # log4j2.StatusLogger.level # Number of StatusLogger events that are kept in a buffer and can be retrieved with StatusLogger.getStatusData(). # Default: 200 # og4j2.status.entries # Fully qualified name of a class that implements the com.lmax.disruptor.ExceptionHandler interface. The class needs to # have a public zero-argument constructor. If specified, this class will be notified when an exception occurs while # logging the messages. # If not specified, the default exception handler will print a message and stack trace to the standard error output stream. # Default: default handler # AsyncLogger.ExceptionHandler # Size (number of slots) in the RingBuffer used by the asynchronous logging subsystem. Make this value large enough to # deal with bursts of activity. The minimum size is 128. The RingBuffer will be pre-allocated at first use and will # never grow or shrink during the life of the system. # Default: 256 * 1024 # AsyncLogger.RingBufferSize # Valid values: Block, Timeout, Sleep, Yield. # Block is a strategy that uses a lock and condition variable for the I/O thread waiting for log events. Block can be # used when throughput and low-latency are not as important as CPU resource. Recommended for resource # constrained/virtualised environments. # # Timeout is a variation of the Block strategy that will periodically wake up from the lock condition await() call. # This ensures that if a notification is missed somehow the consumer thread is not stuck but will recover with a small # latency delay (default 10ms). # # Sleep is a strategy that initially spins, then uses a Thread.yield(), and eventually parks for the minimum number of # nanos the OS and JVM will allow while the I/O thread is waiting for log events. Sleep is a good compromise between # performance and CPU resource. This strategy has very low impact on the application thread, in exchange for some # additional latency for actually getting the message logged. # # Yield is a strategy that uses a Thread.yield() for waiting for log events after an initially spinning. Yield is a # good compromise between performance and CPU resource, but may use more CPU than Sleep in order to get the message # logged to disk sooner. # # Default: Timeout AsyncLogger.WaitStrategy=Sleep # Valid values: CACHED, UNCACHED. # By default, AsyncLogger caches the thread name in a ThreadLocal variable to improve performance. Specify the UNCACHED # option if your application modifies the thread name at runtime (with Thread.currentThread().setName()) and you want # to see the new thread name reflected in the log. # # Note: CACHED turns mSeries logs into mess as dispatcher sets thread name to dispatchId when running task # Default: CACHED AsyncLogger.ThreadNameStrategy=UNCACHED # Fully qualified name of a class that implements the com.lmax.disruptor.ExceptionHandler interface. The class needs to # have a public zero-argument constructor. If specified, this class will be notified when an exception occurs while # logging the messages. If not specified, the default exception handler will print a message and stack trace to the # standard error output stream. # Default: default handler # AsyncLoggerConfig.ExceptionHandler # Size (number of slots) in the RingBuffer used by the asynchronous logging subsystem. Make this value large enough to # deal with bursts of activity. The minimum size is 128. The RingBuffer will be pre-allocated at first use and will # never grow or shrink during the life of the system. # Default: 256 * 1024 # AsyncLoggerConfig.RingBufferSize # Valid values: Block, Timeout, Sleep, Yield. # Block is a strategy that uses a lock and condition variable for the I/O thread waiting for log events. Block can be # used when throughput and low-latency are not as important as CPU resource. Recommended for resource # constrained/virtualised environments. # # Timeout is a variation of the Block strategy that will periodically wake up from the lock condition await() call. # This ensures that if a notification is missed somehow the consumer thread is not stuck but will recover with a small # latency delay (default 10ms). # # Sleep is a strategy that initially spins, then uses a Thread.yield(), and eventually parks for the minimum number of # nanos the OS and JVM will allow while the I/O thread is waiting for log events. Sleep is a good compromise between # performance and CPU resource. This strategy has very low impact on the application thread, in exchange for some # additional latency for actually getting the message logged. # # Yield is a strategy that uses a Thread.yield() for waiting for log events after an initially spinning. Yield is a # good compromise between performance and CPU resource, but may use more CPU than Sleep in order to get the message # logged to disk sooner. # # Default: Timeout AsyncLoggerConfig.WaitStrategy=Sleep # Default LoggerAdapter to use in the JUL adapter. By default, if log4j-core is available, then the class # org.apache.logging.log4j.jul .CoreLoggerAdapter will be used. Otherwise, the ApiLogggerAdapter will be used. # Custom implementations must provide a public default constructor. # Default: org.apache.logging.log4j.jul.ApiLoggerAdapter # log4j.jul.LoggerAdapter # If false (the default), Log4j will make sure the message is formatted in the caller thread, to ensure the value at # the time of the call to the logger is the value that is logged. # Default: false # log4j.format.msg.async # Used by Async Loggers and the AsyncAppender to maintain application throughput even when the underlying appender # cannot keep up with the logging rate and the queue is filling up. # # If no value is specified (the default) events are never discarded. If the queue is full, the logger call blocks until # the event can be added to the queue. # # Specify Discard to drop events whose level is equal or less than the threshold level (INFO by default) when the # queue is full. log4j2.AsyncQueueFullPolicy=Discard # Used by the DiscardingAsyncQueueFullPolicy to determine which events to drop when the queue becomes full. By default, # INFO, DEBUG and TRACE level events are discarded when the queue is full. This property only has effect if Discard is # specified as the log4j2.AsyncQueueFullPolicy. # Default: INFO log4j2.DiscardThreshold=DEBUG # Default message factory used by Loggers if no factory was specified. # Default: org.apache.logging.log4j.message.ParameterizedMessageFactory or org.apache.logging.log4j.message.ReusableMessageFactory in garbage-free mode # log4j2.messageFactory # Default flow message factory used by Loggers. # Default: org.apache.logging.log4j.message.DefaultFlowMessageFactory # log4j2.flowMessageFactory # This system property can be used to force Log4j 2 to behave as if it is part of a web application (when true) or as # if it is not part of a web application (when false). # Default: true if Servlet class on class path log4j2.is.webapp=false # This system property can be used to switch off the use of threadlocals, which will partly disable Log4j's # garbage-free behaviour: to be fully garbage-free, Log4j stores objects in ThreadLocal fields to reuse them, otherwise # new objects are created for each log event. Note that this property is not effective when Log4j detects it is running # in a web application. # Default: true # log4j2.enable.threadlocals # This property can be used to force garbage-aware Layouts and Appenders to revert to the pre-2.6 behaviour where # converting log events to text generates temporary objects like Strings and char[] arrays, and converting this text to # bytes generates temporary byte[] arrays. By default, this property is true and garbage-aware Layouts and Appenders # that convert log events to text will convert this text to bytes without creating temporary objects. # Default: true # log4j2.enable.direct.encoders # In GC-free mode, this property determines the initial size of the reusable StringBuilders where the message text is # formatted and potentially passed to background threads. # Default: 128 log4j.initialReusableMsgSize=512 # In GC-free mode, this property determines the maximum size of the reusable StringBuilders where the message text is # formatted and potentially passed to background threads. # Default: 518 log4j.maxReusableMsgSize=2048 # This property determines the maximum size of the thread-local reusable StringBuilders used to format the log event to # text by Layouts that extend AbstractStringLayout. # Default: 2048 log4j.layoutStringBuilder.maxSize=4096 # The org.apache.logging.log4j.util.Unbox utility manages a small thread-local ring buffer of StringBuilders. Each time # one of the box() methods is called, the next slot in the ring buffer is used, until the ring buffer is full and the # first slot is reused. By default the Unbox ring buffer has 32 slots, so user code can have up to 32 boxed primitives # in a single logger call. # If more slots are required, set system property log4j.unbox.ringbuffer.size to the desired ring buffer size. # Note that the specified number will be rounded up to the nearest power of 2. # Default: 32 # log4j.unbox.ringbuffer.size # Prints a stacktrace to the status logger at DEBUG level when the LoggerContext is started. For debug purposes. # Default: false # log4j.LoggerContext.stacktrace.on.start {code} > NullPointerException from AsyncLogger > ------------------------------------- > > Key: LOG4J2-2816 > URL: https://issues.apache.org/jira/browse/LOG4J2-2816 > Project: Log4j 2 > Issue Type: Bug > Components: Core > Affects Versions: 2.13.0 > Reporter: Denis > Priority: Minor > > We've got several times following NullPointerException (example from our > stdout.log): > > {code:java} > 84449.232: [purging class loader data graph, 0.0000003 secs] > AsyncLogger error handling event seq=1037012, > value='org.apache.logging.log4j.core.async.RingBufferLogEvent@2a7b2d78': > java.lang.NullPointerException: null > java.lang.NullPointerException > at > org.apache.logging.log4j.core.async.RingBufferLogEvent.execute(RingBufferLogEvent.java:161) > at > org.apache.logging.log4j.core.async.RingBufferLogEventHandler.onEvent(RingBufferLogEventHandler.java:46) > at > org.apache.logging.log4j.core.async.RingBufferLogEventHandler.onEvent(RingBufferLogEventHandler.java:29) > at > com.lmax.disruptor.BatchEventProcessor.processEvents(BatchEventProcessor.java:168) > at com.lmax.disruptor.BatchEventProcessor.run(BatchEventProcessor.java:125) > at java.lang.Thread.run(Thread.java:748) > AsyncLogger error handling event seq=1037022, > value='org.apache.logging.log4j.core.async.RingBufferLogEvent@d5d330f': > java.lang.NullPointerException: null > java.lang.NullPointerException > at > org.apache.logging.log4j.core.async.RingBufferLogEvent.execute(RingBufferLogEvent.java:161) > at > org.apache.logging.log4j.core.async.RingBufferLogEventHandler.onEvent(RingBufferLogEventHandler.java:46) > at > org.apache.logging.log4j.core.async.RingBufferLogEventHandler.onEvent(RingBufferLogEventHandler.java:29) > at > com.lmax.disruptor.BatchEventProcessor.processEvents(BatchEventProcessor.java:168) > at com.lmax.disruptor.BatchEventProcessor.run(BatchEventProcessor.java:125) > at java.lang.Thread.run(Thread.java:748) > 84450.232: [deflating idle monitors, 0.0000624 secs] > {code} > > What is interesting this NPEs always preceeded by > {code} > 84449.232: [purging class loader data graph, 0.0000003 secs] vm message > {code} -- This message was sent by Atlassian Jira (v8.3.4#803005)