############################### 日志记录器定义 ###############################
# 日志输出级别 OFF、DEBUG、INFO、WARN、ERROR
log4j.rootLogger = ERROR,consoleAppender,info,warn,error
############################### 日志输出控制器定义 ###############################
#根记录器 控制台输出控制器
log4j.appender.consoleAppender = org.apache.log4j.ConsoleAppender
log4j.appender.consoleAppender.Target = System.out
log4j.appender.consoleAppender.layout = org.apache.log4j.PatternLayout
log4j.appender.consoleAppender.layout.ConversionPattern = %-d{yyyy-MM-dd HH/:mm/:ss} – %C [%t/:%r] – [%p] %m%n
#根记录器 文件输出控制器 INFO
log4j.logger.info=info
log4j.appender.info = org.apache.log4j.RollingFileAppender
log4j.appender.info.encoding=UTF-8
log4j.appender.info.File =E://tomcat-8.5.16-x86//mylog//info.log
log4j.appender.info.Append = true
log4j.appender.info.Threshold = INFO
log4j.appender.info.MaxFileSize=900KB
log4j.appender.info.MaxBackupIndex=1
log4j.appender.info.layout = org.apache.log4j.PatternLayout
log4j.appender.info.layout.ConversionPattern = %-d{yyyy-MM-dd HH/:mm/:ss} – %C [%t/:%r] – [%p] %m%n
#根记录器 文件输出控制器 WARN
log4j.logger.warn=warn
log4j.appender.warn = org.apache.log4j.RollingFileAppender
log4j.appender.warn.encoding=UTF-8
log4j.appender.warn.File =E://tomcat-8.5.16-x86//mylog//warn.log
log4j.appender.warn.Append = true
log4j.appender.warn.Threshold = WARN
log4j.appender.warn.MaxFileSize=900KB
log4j.appender.warn.MaxBackupIndex=1
log4j.appender.warn.layout = org.apache.log4j.PatternLayout
log4j.appender.warn.layout.ConversionPattern = %-d{yyyy-MM-dd HH/:mm/:ss} – %C [%t/:%r] – [%p] %m%n
#根记录器 文件输出控制器 ERROR
log4j.logger.error=error
log4j.appender.error = org.apache.log4j.RollingFileAppender
log4j.appender.error.encoding=UTF-8
log4j.appender.error.File =E://tomcat-8.5.16-x86//mylog//error.log
log4j.appender.error.Append = true
log4j.appender.error.Threshold = ERROR
log4j.appender.error.MaxFileSize=900KB
log4j.appender.error.MaxBackupIndex=1
log4j.appender.error.layout = org.apache.log4j.PatternLayout
log4j.appender.error.layout.ConversionPattern = %-d{yyyy-MM-dd HH/:mm/:ss} – %C [%t/:%r] – [%p] %m%n
原创文章,作者:Maggie-Hunter,如若转载,请注明出处:https://blog.ytso.com/15456.html