首页 > 其他 > 详细

log4j分等级记录日志配置示例

时间:2015-05-17 00:51:39      阅读:244      评论:0      收藏:0      [点我收藏+]


# Set root logger level to WARN and append to stdout
log4j.rootLogger=debug, stdout, error

log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
# Pattern to output the caller‘s file name and line number.
log4j.appender.stdout.layout.ConversionPattern=%d %5p (%c:%L) - %m%n

# Print only messages of level ERROR or above in the package noModule.
#log4j.logger.noModule=FATAL

# OpenSymphony Stuff
#log4j.logger.com.opensymphony=INFO
#log4j.logger.com.opensymphony.webwork=DEBUG

# Spring Stuff
log4j.logger.org.springframework=INFO

#                       
log4j.appender.error=org.apache.log4j.DailyRollingFileAppender
log4j.appender.error.File=d:/errors.log
log4j.appender.error.layout=org.apache.log4j.PatternLayout
log4j.appender.error.layout.ConversionPattern=[%d]-%-5p (%F:%L)|%m%n
log4j.appender.error.DatePattern=‘.‘yyyy-MM-dd
log4j.appender.error.Threshold=ERROR

###################################
#                       CONSOLE #
#################################

log4j.appender.console=org.apache.log4j.ConsoleAppender
log4j.appender.console.layout=org.apache.log4j.PatternLayout
log4j.appender.console.layout.ConversionPattern=(%F:%L)|%m%n

log4j.appender.errorcsle=org.apache.log4j.ConsoleAppender
log4j.appender.errorcsle.layout=org.apache.log4j.PatternLayout
log4j.appender.errorcsle.layout.ConversionPattern=%-5p (%F:%L)|%m%n
log4j.appender.errorcsle.Threshold=ERROR

##################################
#                       
#################################
log4j.logger.com.forg=DEBUG, logic

log4j.appender.logic=org.apache.log4j.DailyRollingFileAppender
log4j.appender.logic.File=d:/logic.log
log4j.appender.logic.layout=org.apache.log4j.PatternLayout
log4j.appender.logic.layout.ConversionPattern=[%d]-%-5p (%F:%L)|%m%n
log4j.appender.logic.DatePattern=‘.‘yyyy-MM-dd



log4j分等级记录日志配置示例

原文:http://my.oschina.net/kanlianhui/blog/415809

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!