log4j.rootLogger=error,stdout,D, E, F, G
#log4j.appender.stdout=org.apache.log4j.ConsoleAppender
#log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
#log4j.appender.stdout.layout.ConversionPattern=%5p [%t] - %m%n
#企业库logstar
log4j.logger.com.leo.company=info,company
log4j.appender.company=org.apache.log4j.DailyRollingFileAppender
log4j.appender.company.File = D:/logs/leo/company/log.log
log4j.appender.company.Encoding = UTF-8
log4j.appender.company.DatePattern = '_'yyyy-MM-dd'.log'
log4j.appender.company.Append = true
log4j.appender.company.Threshold = INFO
log4j.appender.company.layout = org.apache.log4j.PatternLayout
log4j.appender.company.layout.ConversionPattern = %-d{yyyy-MM-dd HH:mm:ss} [ %t:%r ] - [ %p ] %m%n
#企业库logend
### 保存DEBUG信息到单独文件 ###
log4j.appender.D = org.apache.log4j.DailyRollingFileAppender
log4j.appender.D.File = D:/logs/leo/debug/debug_log.txt
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} [ %c:%r ] - [ %p ] %m%n
log4j.appender.D.MaxBackupIndex=10
### 保存INFO信息到单独文件 ###
log4j.appender.E = org.apache.log4j.DailyRollingFileAppender
log4j.appender.E.File = D:/logs/leo/info/info_log.txt
log4j.appender.E.Append = true
log4j.appender.E.Threshold = INFO
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
log4j.appender.E.MaxBackupIndex=10
### 保存WARN信息到单独文件 ###
log4j.appender.F = org.apache.log4j.DailyRollingFileAppender
log4j.appender.F.File = D:/logs/leo/warn/warn_log.txt
log4j.appender.F.Append = true
log4j.appender.F.Threshold = WARN
log4j.appender.F.layout = org.apache.log4j.PatternLayout
log4j.appender.F.layout.ConversionPattern = %-d{yyyy-MM-dd HH:mm:ss} [ %t:%r ] - [ %p ] %m%n
log4j.appender.F.MaxBackupIndex=10
### 保存ERROR信息到单独文件 ###
log4j.appender.G = org.apache.log4j.DailyRollingFileAppender
log4j.appender.G.File = D:/logs/leo/error/error_log.txt
log4j.appender.G.Append = true
log4j.appender.G.Threshold = ERROR
log4j.appender.G.layout = org.apache.log4j.PatternLayout
log4j.appender.G.layout.ConversionPattern = %-d{yyyy-MM-dd HH:mm:ss} [ %t:%r ] - [ %p ] %m%n
log4j.appender.G.MaxBackupIndex=10
#log4j.appender.stdout=org.apache.log4j.ConsoleAppender
#log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
#log4j.appender.stdout.layout.ConversionPattern=%5p [%t] - %m%n
#企业库logstar
log4j.logger.com.leo.company=info,company
log4j.appender.company=org.apache.log4j.DailyRollingFileAppender
log4j.appender.company.File = D:/logs/leo/company/log.log
log4j.appender.company.Encoding = UTF-8
log4j.appender.company.DatePattern = '_'yyyy-MM-dd'.log'
log4j.appender.company.Append = true
log4j.appender.company.Threshold = INFO
log4j.appender.company.layout = org.apache.log4j.PatternLayout
log4j.appender.company.layout.ConversionPattern = %-d{yyyy-MM-dd HH:mm:ss} [ %t:%r ] - [ %p ] %m%n
#企业库logend
### 保存DEBUG信息到单独文件 ###
log4j.appender.D = org.apache.log4j.DailyRollingFileAppender
log4j.appender.D.File = D:/logs/leo/debug/debug_log.txt
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} [ %c:%r ] - [ %p ] %m%n
log4j.appender.D.MaxBackupIndex=10
### 保存INFO信息到单独文件 ###
log4j.appender.E = org.apache.log4j.DailyRollingFileAppender
log4j.appender.E.File = D:/logs/leo/info/info_log.txt
log4j.appender.E.Append = true
log4j.appender.E.Threshold = INFO
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
log4j.appender.E.MaxBackupIndex=10
### 保存WARN信息到单独文件 ###
log4j.appender.F = org.apache.log4j.DailyRollingFileAppender
log4j.appender.F.File = D:/logs/leo/warn/warn_log.txt
log4j.appender.F.Append = true
log4j.appender.F.Threshold = WARN
log4j.appender.F.layout = org.apache.log4j.PatternLayout
log4j.appender.F.layout.ConversionPattern = %-d{yyyy-MM-dd HH:mm:ss} [ %t:%r ] - [ %p ] %m%n
log4j.appender.F.MaxBackupIndex=10
### 保存ERROR信息到单独文件 ###
log4j.appender.G = org.apache.log4j.DailyRollingFileAppender
log4j.appender.G.File = D:/logs/leo/error/error_log.txt
log4j.appender.G.Append = true
log4j.appender.G.Threshold = ERROR
log4j.appender.G.layout = org.apache.log4j.PatternLayout
log4j.appender.G.layout.ConversionPattern = %-d{yyyy-MM-dd HH:mm:ss} [ %t:%r ] - [ %p ] %m%n
log4j.appender.G.MaxBackupIndex=10
本文详细介绍了Log4j的日志配置方法,包括不同级别的日志输出路径、格式及滚动策略等。通过具体配置示例,展示了如何将不同严重级别的日志信息记录到独立的文件中。
1385

被折叠的 条评论
为什么被折叠?



