论坛首页 Java企业应用论坛

答复: 在使用了hibernate,spring,struts后,各位怎么使用log4j输出日志的?

浏览 1338 次
该帖已经被评为隐藏帖
作者 正文
   发表时间:2008-05-06  
# Set root logger level to ERROR.
log4j.rootLogger=ALL, error, errorcsle

log4j.appender.error=org.apache.log4j.DailyRollingFileAppender
log4j.appender.error.File=logs/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

#################################
#                       ENF #
#################################
log4j.logger.com.esoon.ps=DEBUG, logic

log4j.appender.logic=org.apache.log4j.DailyRollingFileAppender
log4j.appender.logic.File=logs/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



#################################
#                           HBT #
#################################
log4j.logger.org.hibernate=DEBUG, HBT
#log4j.logger.cirrus.hibernate.ps.PreparedStatementCache=info, HBT
#log4j.logger.cirrus.hibernate.type=info, HBT

log4j.appender.HBT=org.apache.log4j.DailyRollingFileAppender
log4j.appender.HBT.File=logs/hbt.log
log4j.appender.HBT.layout=org.apache.log4j.PatternLayout
log4j.appender.HBT.layout.ConversionPattern=[%d]-%-5p %c{1}|%m%n
log4j.appender.HBT.DatePattern='.'yyyy-MM-dd


log4j一般都是要打到多个文件里的
论坛首页 Java企业应用版

跳转论坛:
Global site tag (gtag.js) - Google Analytics