我的应用程序有一个log4j.properties,它允许我正确配置log4j.rootLogger=INFO, stdout.但是我仍然看到: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.运行应用程序时.我的log4j.properties当前显示为:log4j.rootLogger=INFO, stdoutlog4j.appender.stdout=org.apache.log4j.ConsoleAppenderlog4j.appender.stdout.layout=org.apache.log4j.PatternLayoutlog4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %t %c:%L - %m%n#log4j.category.org.springframework=DEBUG,stdout我还尝试通过以下方式将属性文件添加到我的配置中:@PropertySource(value= { "classpath:/log4j.properties", "classpath:/application.properties"})如何使该错误消失?我可以通过此文件在DEBUG和INFO之间切换,所以我知道它正在被读取.解决方案您可以通过添加以下行来使此错误消失log4j.logger.org.jboss.logging=INFO, stdout到您的log4j.properties.我不知道为什么,但是似乎有些东西将org.jboss.logging的可加性设置为false,从而导致它忽略了根附加程序.因此,您可以找到那个神奇的地方,也可以在上面添加一行.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, stdoutlog4j.appender.stdout=org.apache.log4j.ConsoleAppenderlog4j.appender.stdout.layout=org.apache.log4j.PatternLayoutlog4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %t %c:%L - %m%n#log4j.category.org.springframework=DEBUG,stdoutI'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. 解决方案 You can make this error go away by adding the linelog4j.logger.org.jboss.logging=INFO, stdoutto 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. 这篇关于log4j在获取我的配置时显示错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 10-27 22:05