Log4j2-AsyncLoggerConfig.WaitStrategy

Log4j2-AsyncLoggerConfig.WaitStrategy,log4j,log4j2,Log4j,Log4j2,我已经将JVM env变量设置为asynchloggerconfig.WaitStrategy=Sleep(即使它是默认值) 但是在启动服务器时,我在服务器日志中得到null,并且log4j2使用中断器事件处理程序作为阻塞等待策略而不是睡眠等待策略 好心帮忙 TRACE AsyncLoggerConfigHelper creating new disruptor. Ref count is 1. DEBUG property AsyncLoggerConfig.WaitStrategy=null

我已经将JVM env变量设置为asynchloggerconfig.WaitStrategy=Sleep(即使它是默认值)

但是在启动服务器时,我在服务器日志中得到null,并且log4j2使用中断器事件处理程序作为阻塞等待策略而不是睡眠等待策略

好心帮忙

TRACE AsyncLoggerConfigHelper creating new disruptor. Ref count is 1.
DEBUG property AsyncLoggerConfig.WaitStrategy=null
DEBUG disruptor event handler uses BlockingWaitStrategy
DEBUG Starting AsyncLoggerConfig disruptor with ringbuffer size=262144, waitStrategy=BlockingWaitStrategy, exceptionHandler=null...
TRACE AsyncLoggerConfig[] starting...
TRACE AsyncLoggerConfigHelper not starting new disruptor, using existing object. Ref count is 2.
TRACE AsyncLoggerConfig[] starting...
TRACE AsyncLoggerConfigHelper not starting new disruptor, using existing object. Ref count is 3.
TRACE AsyncLoggerConfig[] starting...
TRACE AsyncLoggerConfigHelper not starting new disruptor, using existing object. Ref count is 4.
TRACE AsyncLoggerConfig[] starting...
TRACE AsyncLoggerConfigHelper not starting new disruptor, using existing object. Ref count is 5.
TRACE AsyncLoggerConfig[] starting...
TRACE AsyncLoggerConfigHelper not starting new disruptor, using existing object. Ref count is 6.
TRACE AsyncLoggerConfig[] starting...

添加AsyncLoggerConfig.WaitStrategy=Sleep in System属性后,我注意到日志中的等待策略更改为Sleep

属性AsyncLoggerConfig.WaitStrategy=睡眠启动 AsyncLoggerConfig中断器,其ringbuffer大小=262144, waitStrategy=SleepingWaitStrategy,exceptionHandler=null


你说得对。网站文档已过时。默认设置是阻塞。在log4j 2.6中,文档将正确地表示阻塞

更新:从2.6开始,默认设置为超时,类似于阻塞,但偶尔会唤醒