No appenders could be found for logger(log4j)?

前端 未结 30 2310
[愿得一人]
[愿得一人] 2020-11-22 08:16

I have put log4j to my buildpath, but I get the following message when I run my application:

log4j:WARN No appenders could be found for logger (dao.hsqlmanag         


        
30条回答
  •  醉酒成梦
    2020-11-22 08:55

    The solution on this site worked for me https://crunchify.com/java-how-to-configure-log4j-logger-property-correctly/. I now see no warnings at all from log4j

    I put this in a log4j.properties file that I put in src/main/resources

    # This sets the global logging level and specifies the appenders
    log4j.rootLogger=INFO, theConsoleAppender
    
    # settings for the console appender
    log4j.appender.theConsoleAppender=org.apache.log4j.ConsoleAppender
    log4j.appender.theConsoleAppender.layout=org.apache.log4j.PatternLayout
    log4j.appender.theConsoleAppender.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n
    

提交回复
热议问题