Configure asynchronous logs in log4j2.properties

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

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

I tried this 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 wrong.

What is the correct way to configure it?

+1
source share
1 answer

The following is one way to use AsyncLoggerthe file log4j2 properties-

logger.com.foo.Bar.type = AsyncLogger
logger.com.foo.Bar.name = com.foo.Bar
logger.com.foo.Bar.level = info
+1
source

All Articles