log4j.properties这个文件资料里面没有,从网上下载下来也没生效
log4j.properties这个文件资料里面没有,从网上下载下来也没生效
log4j.properties这个文件资料里面没有,从网上下载下来也没生效
2021-08-21
如果使用idea创建工程的话,要把这个log4j.properties这个文件放到resources这个目录下面
另外,附上log4j.properties里面的配置,给我这个好人点个赞吧(课程是2017年的,也就我这个好人了)
### 设置 ### log4j.rootLogger = debug,stdout,D,E log4j.logger.httpclient.wire.header=WARN log4j.logger.httpclient.wire.content=WARN ### 输出信息到控制抬 ### log4j.appender.stdout = org.apache.log4j.ConsoleAppender log4j.appender.stdout.Threshold = INFO log4j.appender.stdout.Target = System.out log4j.appender.stdout.layout = org.apache.log4j.PatternLayout log4j.appender.stdout.layout.ConversionPattern = [%-5p] %d{yyyy-MM-dd HH:mm:ss,SSS} %m%n ### 输出DEBUG 级别以上的日志到target/logs/log.log ### log4j.appender.D = org.apache.log4j.DailyRollingFileAppender log4j.appender.D.File = target/logs/log.log log4j.appender.D.Append = true log4j.appender.D.Threshold = DEBUG log4j.appender.D.layout = org.apache.log4j.PatternLayout log4j.appender.D.layout.ConversionPattern = %-d{yyyy-MM-dd HH:mm:ss} [ %-5p ] [ method:%l ] %m%n ### 输出ERROR 级别以上的日志到target/logs/error.log ### log4j.appender.E = org.apache.log4j.DailyRollingFileAppender log4j.appender.E.File = target/logs/error.log log4j.appender.E.Append = true log4j.appender.E.Threshold = ERROR log4j.appender.E.layout = org.apache.log4j.PatternLayout log4j.appender.E.layout.ConversionPattern = %-d{yyyy-MM-dd HH:mm:ss} [ %-5p ] [ method:%l ] %m%n
举报