log4j showing error when it's picking up my co

2019-08-10 01:19发布

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.

标签: java log4j
1条回答
淡お忘
2楼-- · 2019-08-10 01:42

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.

查看更多
登录 后发表回答