目前各系统都是记录所有的日志,产生日志文件太大,按照如下设置修改log4j.properties文件;其中橙色部分为系统名称,例如water-scada系统,名称可以为scada。
#Sun Jun 01 18:28:45 EDT 2003
log4j.rootCategory=INFO,standard,A1
log4j.appender.standard=org.apache.log4j.ConsoleAppender
log4j.appender.standard.layout=org.apache.log4j.PatternLayout
log4j.appender.standard.layout.ConversionPattern=%-5p: %d{ISO8601}: %C{1}[line:%L]: %m%n
#记录表内交易日志,级别使用fatal
log4j.logger.fatal=A1
log4j.appender.A1=org.apache.log4j.DailyRollingFileAppender
log4j.appender.A1.Threshold=ERROR
log4j.appender.A1.Append=true
log4j.appender.A1.File=/Logs/patrol/web.log
log4j.appender.A1.MaxFileSize=5MB
log4j.appender.A1.MaxBackupIndex=100
log4j.appender.A1.DatePattern = '.'yyyy-MM-dd'.log'
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
log4j.appender.A1.layout.ConversionPattern=%d{ISO8601}: %C{1}[line:%L]: %m%n
#为了显示参数
log4j.logger.org.hibernate.type.descriptor.sql.BasicBinder=TRACE
log4j.loggerorg.hibernate.type.descriptor.sql.BasicExtractor=TRACE
#查看查询中命名参数的值
log4j.logger.org.hibernate.engine.QueryParameters=DEBUG
log4j.logger.org.hibernate.engine.query.HQLQueryPlan=DEBUG