I have a spring-boot project in which I am transitioning from Log4j to Log4j2. I have followed the steps in the documentation here. Specifically, I have modified my log4j.xml to cohere with log4j2 standards and renamed it log4j2.xml I have enabled debugging on log4j2 by using the <Configuration status="debug">
setting in my log4j2.xml so I can see log4j2 startup. On startup of my spring boot app, I use the following system settings:
-Dlog4j.configurationFile=log4j2.xml -Dorg.jboss.logging.provider=log4j2
I can see my log4j2.xml in the debug output starting the appenders, etc, and then final log4j2 message stating:
Logging provider: org.jboss.loggin.Log4j2LoggerProvider found via system property
I am using the following jars:
compile group: 'org.slf4j', name: 'slf4j-log4j12', version: '1.7.12'
compile group: 'org.apache.logging.log4j', name: 'log4j-api', version: '2.4.1'
compile group: 'org.springframework.boot', name: 'spring-boot-starter-log4j2', version: '1.4.0.RELEASE'
However, I am still receiving messages from Log4j:
log4j:WARN No appenders could be found for logger log4j:WARN Please initialize the log4j system properly log4j WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info
So my underlying question is how to shut off log4j and only use log4j2? Is there a message I will receive from log4j2 that will explicitly tell me when I have properly configured it correctly? Is there any special configurations I am missing to use Log4j2?
spring-boot-starter-log4j2
one. – M. Deinum