`
tingjia_2009
  • 浏览: 15176 次
  • 性别: Icon_minigender_2
  • 来自: 北京
最近访客 更多访客>>
社区版块
存档分类
最新评论

简单的log4j.propertier配置

阅读更多

简单的log4j.properties配置,不详细解释了
使用的方式
Logger successLog = Logger.getLogger("switch.success");
Logger failedLog = Logger.getLogger("switch.failed");
适应情况:
只用一个呢,就是简单的Log记录
两个同时用,可以将正确的信息记录在successLog中,异常的信息记录在failedLog中,方便错误的追踪
#---------------------------------------------------------------------
log4j.logger.switch.success=,success.onlineFile,success.onlineConsole
log4j.logger.switch.failed=,failed.onlineFile,failed.onlineConsole


# file appender for success.onlineFile
log4j.appender.success.onlineFile=org.apache.log4j.DailyRollingFileAppender   
log4j.appender.success.onlineFile.file=E:\\switchLog\\success.txt  
log4j.appender.success.onlineFile.DatePattern=.yyyy-MM-dd   
log4j.appender.success.onlineFile.layout=org.apache.log4j.PatternLayout   
log4j.appender.success.onlineFile.layout.ConversionPattern=%m%n

# file appender for success.onlineConsole
log4j.appender.success.onlineConsole.onlineConsole=org.apache.log4j.ConsoleAppender
log4j.appender.success.onlineConsole.onlineConsole.layout=org.apache.log4j.PatternLayout   
log4j.appender.success.onlineConsole.layout.ConversionPattern=%m%n


# file appender for study.onlineFile   
log4j.appender.failed.onlineFile=org.apache.log4j.DailyRollingFileAppender   
log4j.appender.failed.onlineFile.file=E:\\switchLog\\failed.txt  
log4j.appender.failed.onlineFile.DatePattern=.yyyy-MM-dd   
log4j.appender.failed.onlineFile.layout=org.apache.log4j.PatternLayout   
log4j.appender.failed.onlineFile.layout.ConversionPattern=%m%n

# file appender for failed.onlineConsole  
log4j.appender.failed.onlineConsole=org.apache.log4j.ConsoleAppender
log4j.appender.failed.onlineConsole.layout=org.apache.log4j.PatternLayout   
log4j.appender.failed.onlineConsole.layout.ConversionPattern=%m%n
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics