Skip to content
Advertisement

Apache Log4j2 package specific logging using log4j2.xml

I am using log4j2. But the problem that I am facing is that it logs all logs. I want to … log from specific package to a specific file & other package to another file. I am using log4j2.xml for configuration. Please can someone help?

log4j2.xml

JavaScript

JavaScript

Advertisement

Answer

Just answered the question.

log4j2.xml

JavaScript

Removed the <AppenderRef level="DEBUG" ref="fileAppender" /> from root logger. Thus it started logging logs based on packages.

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement