日志文件配置的区别
log4j.appender.logfile.File 和log4j.appender.logfile.E.File 的区别? 求说详细一点,我菜鸟 求高手指点
[解决办法]
木有啥区别。都是一个输出标识而已:定义了日志级别之后,你可以定义一个或多个输出,分别用来存储不同类型的日志。例如:
### set log levels ###
#log4j.rootLogger = debug , info, stdout , D, E
log4j.rootLogger = info, stdout , D, E
### print to console ###
log4j.appender.info = org.apache.log4j.ConsoleAppender
log4j.appender.info.Target = System.out
log4j.appender.info.layout = org.apache.log4j.PatternLayout
log4j.appender.info.layout.ConversionPattern = %d{ABSOLUTE} %5p %c{1}:%L - %m%n
### print to console ###
log4j.appender.stdout = org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target = System.out
log4j.appender.stdout.layout = org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern = %d{ABSOLUTE} %5p %c{1}:%L - %m%n
### print to log file ###
log4j.appender.D = org.apache.log4j.DailyRollingFileAppender
log4j.appender.D.File = logs/error.log
log4j.appender.D.Append = true
log4j.appender.D.Threshold = ERROR
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
### print to log file ###
log4j.appender.E = org.apache.log4j.DailyRollingFileAppender
log4j.appender.E.File = logs/stdout.log
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