log4j showing error when it's picking up my configuration

雨燕双飞 提交于 2019-12-11 04:02:44

问题


I'm having the same issue described here: Log4j Warning while initializing?

My application has a log4j.properties that allows me to configure log4j.rootLogger=INFO, stdout correctly. However I still see:

log4j:WARN No appenders could be found for logger (org.jboss.logging).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.

When running the application.

My log4j.properties currently reads:

log4j.rootLogger=INFO, stdout

log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %t %c:%L - %m%n

#log4j.category.org.springframework=DEBUG,stdout

I've also tried adding the properties file to my config via:

@PropertySource(value= {
        "classpath:/log4j.properties",
        "classpath:/application.properties"
})

How can I make this error go away? I can toggle between DEBUG and INFO just fine via this file, so I know it's being read.


回答1:


You can make this error go away by adding the line

log4j.logger.org.jboss.logging=INFO, stdout

to your log4j.properties.
I don't know why, but it seems like something sets the additivity of org.jboss.logging to false, causing it to ignore the root appender(s). So you can either find that magical spot or you add the the line above.



来源:https://stackoverflow.com/questions/15910901/log4j-showing-error-when-its-picking-up-my-configuration

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!