logger

Logger配置文件说明

   文件一定在src下,并命名为log4j.properties

 ### 全局默认配置
log4j.rootLogger = debug,stdout,D,E

### 设置控制台日志输出 ###
log4j.appender.stdout = org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target = System.out
##设置日志级别
log4j.appender.stdout.Threshold = INFO
##布局样式
log4j.appender.stdout.layout
= org.apache.log4j.PatternLayout
##具体样式格式
log4j.appender.stdout.layout.ConversionPattern
= [%-5p] %d{yyyy-MM-dd HH:mm:ss,SSS} method:%l%n%m%n
###设置文件输出配置###
##每天产生一个DEBUG日志文件放到指定目录
=E://logs/error.log log4j.appender.D = org.apache.log4j.DailyRollingFileAppender ##log4j.appender.D.File =logs/log.log
##输出文件地址
log4j.appender.D.File =E://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} [ %t:%r ] - [ %p ] %m%n ### 每天产生一个ERROR级别日志到指定目录存储=E://logs/error.log ### log4j.appender.E = org.apache.log4j.DailyRollingFileAppender log4j.appender.E.File =E://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} [ %t:%r ] - [ %p ] %m%n

详解

https://blog.csdn.net/anlina_1984/article/details/5313023/

 

posted @ 2021-04-24 23:58  当当小丸子  阅读(265)  评论(0编辑  收藏  举报