Configuring async loggers in log4j2.properties

2019-01-26 17:23发布

I want to make some loggers asynchronous in log4j2.properties file. In the xml format you can add as

<Loggers>
    <AsyncLogger name="com.foo.Bar" level="info">
    </AsyncLogger>
</Loggers>

I tried it in log4j2.properties as loggers = com-foo-Bar

asyncLogger.com-foo-Bar.name = com.foo.Bar
asyncLogger.com-foo-Bar.level = INFO

But this syntax seems to be wrong.

What is the correct way to configure it?

1条回答
再贱就再见
2楼-- · 2019-01-26 18:08

Below is one way of using AsyncLogger in log4j2 properties file -

logger.com.foo.Bar.type = AsyncLogger
logger.com.foo.Bar.name = com.foo.Bar
logger.com.foo.Bar.level = info
查看更多
登录 后发表回答