log4j.xmlde两种配置方式
log4j 有两种配置方法,大家熟知的是properties文件但是最近的项目实施中,每次去用户那里装系统,都要苦恼于log文件放在不同位置,要改property文件就要重打jar包,麻烦的紧。而如果采用 xml配置的方法,直接放在WEB-INFO下,要修改路径,很方便。查了些资料,终于把系统的log4j改成在xml中配置啦。
记一下记一下……嘿嘿
================================================================================
log4j.properties# This is the configuring for logging displayed in the Application Serverlog4j.rootCategory=INFO, stdout,logfile#stdout configurelog4j.appender.stdout=org.apache.log4j.ConsoleAppenderlog4j.appender.stdout.layout=org.apache.log4j.PatternLayoutlog4j.appender.stdout.layout.ConversionPattern= %d %p [%c] - <%m>%n#logfile configurelog4j.appender.logfile=org.apache.log4j.DailyRollingFileAppenderlog4j.appender.logfile.File=/role.loglog4j.appender.logfile.layout=org.apache.log4j.PatternLayoutlog4j.appender.logfile.layout.ConversionPattern= %d %p [%c] - <%m>%n# Control logging for other open source packages# Changing the log level to DEBUG when debuglog4j.logger.org.springframework=WARN# Changing the log level to DEBUG will display SQL Hibernate generatedlog4j.logger.org.hibernate=WARNlog4j.logger.org.hibernate.SQL=ERRORlog4j.logger.org.hibernate.cache=ERRORlog4j.logger.net.sf.ehcache=ERROR