<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern"
value="[SKG.com] %-d{yyyy-MM-dd HH:mm:ss} %p [%t] %c{1}.%M(%L) | %m%n"/>
</layout>
<filter class="org.apache.log4j.varia.LevelRangeFilter">
<param name="LevelMin" value="DEBUG" />
<param name="LevelMax" value="ERROR" />
</filter>
</appender>
<appender name="APPLOGFILE" class="org.apache.log4j.DailyRollingFileAppender">
<param name="File" value="/web/logs/ehrweb/skg-platform.log"/>
<!-- 重启了服务器之后,是否在原有文件的后面追加?true(默认):追加;false:不追加 -->
<param name="Append" value="true"/>
<!-- 最大文件的size,单位:Kb,Mb... -->
<!--<param name="MaxFileSize" value="50MB"/>-->
<!-- 默认 MaxBackupIndex 为 1 -->
<!--<param name="MaxBackupIndex" value="1" />-->
<param name="Encoding" value="utf-8"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="[SKG.com] %-d{yyyy-MM-dd HH:mm:ss} %-5p %-15c{1}: %m%n"/>
</layout>
<filter class="org.apache.log4j.varia.LevelRangeFilter">
<param name="LevelMin" value="DEBUG" />
<param name="LevelMax" value="ERROR" />
</filter>
</appender>
<appender name="MvcFront" class="org.apache.log4j.DailyRollingFileAppender">
<param name="File" value="/web/logs/ehrweb/skg-mvc-front.log"/>
<!-- 重启了服务器之后,是否在原有文件的后面追加?true(默认):追加;false:不追加 -->
<param name="Append" value="true"/>
<!-- 最大文件的size,单位:Kb,Mb... -->
<!--<param name="MaxFileSize" value="50MB"/>-->
<!-- 默认 MaxBackupIndex 为 1 -->
<!--<param name="MaxBackupIndex" value="1" />-->
<param name="Encoding" value="utf-8"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="[SKG.com] %-d{yyyy-MM-dd HH:mm:ss} %-5p %-15c{1}: %m%n"/>
</layout>
<filter class="org.apache.log4j.varia.LevelRangeFilter">
<param name="LevelMin" value="DEBUG" />
<param name="LevelMax" value="DEBUG" />
</filter>
</appender>
<appender name="DEBUG" class="org.apache.log4j.DailyRollingFileAppender">
<param name="File" value="/web/logs/ehrweb/debug.log"/>
<!-- 每小时1个文件 -->
<param name="DatePattern" value="'.'yyyy-MM-dd-HH'.log'" />
<!-- 最大文件的size,单位:Kb,Mb... -->
<!--<param name="MaxFileSize" value="50MB" />-->
<!-- 重启了服务器之后,是否在原有文件的后面追加?true(默认):追加;false:不追加 -->
<param name="Append" value="true"/>
<param name="Encoding" value="utf-8"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="[SKG.com] %-d{yyyy-MM-dd HH:mm:ss} %-5p %-15c{1}: %m%n"/>
</layout>
<filter class="org.apache.log4j.varia.LevelRangeFilter">
<param name="LevelMin" value="DEBUG" />
<param name="LevelMax" value="DEBUG" />
</filter>
</appender>
<appender name="INFO" class="org.apache.log4j.DailyRollingFileAppender">
<param name="File" value="/web/logs/ehrweb/info.log"/>
<param name="Append" value="true"/>
<param name="Encoding" value="utf-8"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="[SKG.com] %-d{yyyy-MM-dd HH:mm:ss} %-5p %-15c{1}: %m%n"/>
</layout>
<filter class="org.apache.log4j.varia.LevelRangeFilter">
<param name="LevelMin" value="INFO" />
<param name="LevelMax" value="INFO" />
</filter>
</appender>
<appender name="WARN" class="org.apache.log4j.DailyRollingFileAppender">
<param name="File" value="/web/logs/ehrweb/warn.log"/>
<param name="Append" value="true"/>
<param name="Encoding" value="utf-8"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="[SKG.com] %-d{yyyy-MM-dd HH:mm:ss} %-5p %-15c{1}: %m%n"/>
</layout>
<filter class="org.apache.log4j.varia.LevelRangeFilter">
<param name="LevelMin" value="WARN" />
<param name="LevelMax" value="WARN" />
</filter>
</appender>
<appender name="ERROR" class="org.apache.log4j.DailyRollingFileAppender">
<param name="File" value="/web/logs/ehrweb/error.log"/>
<param name="Append" value="true"/>
<param name="Encoding" value="utf-8"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="[SKG.com] %-d{yyyy-MM-dd HH:mm:ss} %-5p %-15c{1}: %m%n"/>
</layout>
<filter class="org.apache.log4j.varia.LevelRangeFilter">
<param name="LevelMin" value="ERROR" />
<param name="LevelMax" value="ERROR" />
</filter>
</appender>
<logger name="java.sql.Connection">
<level value="DEBUG"/>
</logger>
<logger name="java.sql.Statement">
<level value="DEBUG"/>
</logger>
<logger name="java.sql.PreparedStatement">
<level value="DEBUG"/>
<appender-ref ref="CONSOLE"/>
</logger>
<logger name="com.ibatis">
<level value="DEBUG"/>
</logger>
<logger name="com.ibatis.common.jdbc.SimpleDataSource">
<level value="WARN"/>
</logger>
<logger name="com.ibatis.common.jdbc.ScriptRunner">
<level value="WARN"/>
</logger>
<logger name="com.ibatis.sqlmap.engine.impl.SqlMapClientDelegate">
<level value="WARN"/>
</logger>
<logger name="org.springframework.jdbc">
<level value="DEBUG"/>
</logger>
<logger name="java.sql.ResultSet">
<level value="WARN"/>
</logger>
<logger name="java.sql">
<level value="DEBUG" />
</logger>
<logger name="org.apache.ibatis">
<level value="DEBUG" />
</logger>
<logger name="org.mybatis">
<level value="DEBUG" />
</logger>
<logger name="org.mybatis.spring">
<level value="DEBUG" />
</logger>
<!-- Suppress success logging from InteractiveAuthenticationSuccessEvent -->
<logger name="org.springframework.security">
<level value="ERROR"/>
</logger>
<logger name="org.apache">
<level value="WARN"/>
</logger>
<logger name="com.skg.web.servlet.SpringMvcServlet">
<level value="ERROR" />
</logger>
<logger name="org.springframework.web.servlet">
<level value="ERROR"/>
</logger>
<logger name="com.skg.crm.base.web.template.MyFreeMarkerView">
<level value="ERROR" />
</logger>
<logger name="com.skg.crm.base.web.template.SpringMvcFrontServlet">
<level value="DEBUG" />
<!--打印到对应的 日志文件里面 -->
<appender-ref ref="MvcFront"/>
<appender-ref ref="CONSOLE"/>
</logger>
<logger name="org.springframework.security">
<level value="ERROR"/>
</logger>
<logger name="org.springframework">
<level value="WARN"/>
</logger>
<logger name="org.displaytag">
<level value="ERROR"/>
</logger>
<logger name="com.skg">
<level value="DEBUG"/>
</logger>
<logger name="org.activiti">
<level value="WARN"/>
</logger>
<logger name="org.springframework.transaction">
<level value="WARN"/>
</logger>
<logger name="org.apache.catalina">
<level value="WARN"/>
</logger>
<logger name="org.quartz">
<level value="WARN"/>
</logger>
<!--
root的作用(相当于全局的意思):
1.[priority ]:指定默认的全局输出级别
2.[appender-ref ]:指定一些默认的append(没有指出特殊包或者类,即那些没有指定<logger>元素的append)的输出;
-->
<root>
<priority value="debug"/>
<!-- <appender-ref ref="CONSOLE"/> -->
<appender-ref ref="APPLOGFILE"/>
<appender-ref ref="DEBUG"/>
<appender-ref ref="INFO"/>
<appender-ref ref="WARN"/>
<appender-ref ref="ERROR"/>
</root>
</log4j:configuration>
参考地址:
http://www.360doc.com/content/10/1114/14/573136_69267215.shtml