你的位置:首页 > Java教程

[Java教程]log4j 配置文件


log4j.rootLogger=info, stdout, log, errorloglog4j.Logger=search,Test###Console ###log4j.appender.stdout = org.apache.log4j.ConsoleAppenderlog4j.appender.stdout.Target = System.outlog4j.appender.stdout.layout = org.apache.log4j.PatternLayoutlog4j.appender.stdout.layout.ConversionPattern = %d{ABSOLUTE} [ %t ] [ %p ]:%L - %m%n### Log ### log4j.appender.log = org.apache.log4j.DailyRollingFileAppenderlog4j.appender.log.File = log/log.loglog4j.appender.log.Append = truelog4j.appender.log.Threshold = INFOlog4j.appender.log.DatePattern='.'yyyy-MM-ddlog4j.appender.log.layout = org.apache.log4j.PatternLayoutlog4j.appender.log.layout.ConversionPattern = %-d{yyyy-MM-dd HH:mm:ss} [ %t ] %m%n### Error ###log4j.appender.errorlog = org.apache.log4j.DailyRollingFileAppenderlog4j.appender.errorlog.File = log/errorlog.loglog4j.appender.errorlog.Append = truelog4j.appender.errorlog.Threshold = ERROR log4j.appender.errorlog.DatePattern='.'yyyy-MM-ddlog4j.appender.errorlog.layout = org.apache.log4j.PatternLayoutlog4j.appender.errorlog.layout.ConversionPattern =%-d{yyyy-MM-dd HH:mm:ss} [ %t ] %m%n