No appenders could be found for logger [IntelliJ IDEA]

网上看了很多说在source文件夹下加一个log4j.properties

其实准确说应该在resources目录下加

在IDEA中,可以加一个文件夹放log4j.properties,并在这个文件夹右键-选择Mark Directory as - Resoures Root

log4j.rootLogger=INFO, Console, DEBUG 
log4j.appender.Console=org.apache.log4j.ConsoleAppender
log4j.appender.Console.layout=org.apache.log4j.PatternLayout
log4j.appender.Console.layout.ConversionPattern=(%r ms) [%t] %-5p: %c#%M %x: %m%n

 

上一篇:Log4j2的Appenders配置详解(1),Java经典面试


下一篇:log4j:WARN No appenders could be found for logger