标签:pattern 继承 max div activex bug imm debug oct
1
<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"> <log4j:configuration xmlns:log4j=‘http://jakarta.apache.org/log4j/‘> <appender name="STDOUT" class="org.apache.log4j.ConsoleAppender"> <layout class="org.apache.log4j.PatternLayout"> <param name="ConversionPattern" value="[%-5p] %m-----%d{yyyy-MM-dd HH:mm:ss\} %l %n" /> </layout> <filter class="org.apache.log4j.varia.LevelRangeFilter"> <param name="LevelMin" value="INFO" /> <param name="LevelMax" value="INFO" /> </filter> </appender> <appender name="HIGHLIGHT" class="org.apache.log4j.ConsoleAppender"> <param name="Target" value="System.err" /> <layout class="org.apache.log4j.PatternLayout"> <param name="ConversionPattern" value="[%-5p] %m-----%d{yyyy-MM-dd HH:mm:ss\} %l %n" /> </layout> <filter class="org.apache.log4j.varia.LevelRangeFilter"> <param name="LevelMin" value="WARN" /> </filter> </appender> <appender name="INFO" class="org.apache.log4j.DailyRollingFileAppender"> <param name="File" value="d:/logs/info.log" /> <param name="Append" value="true" /> <param name="DatePattern" value="‘.‘yyyy-MM-dd‘.log‘"></param> <layout class="org.apache.log4j.PatternLayout"> <param name="ConversionPattern" value=" %-d{yyyy-MM-dd HH:mm:ss} [ %t:%r ] - [ %p ] %m%n" /> </layout> <filter class="org.apache.log4j.varia.LevelRangeFilter"> <param name="LevelMin" value="INFO" /> </filter> </appender> <appender name="WARN" class="org.apache.log4j.DailyRollingFileAppender"> <param name="File" value="d:/logs/warn.log" /> <param name="Append" value="true" /> <param name="DatePattern" value="‘.‘yyyy-MM-dd‘.log‘"></param> <layout class="org.apache.log4j.PatternLayout"> <param name="ConversionPattern" value=" %-d{yyyy-MM-dd HH:mm:ss} [ %t:%r ] - [ %p ] %m%n" /> </layout> <filter class="org.apache.log4j.varia.LevelRangeFilter"> <param name="LevelMin" value="WARN" /> </filter> </appender> <category name="org.apache"> <priority value="warn" /> <appender-ref ref="WARN" /> </category> <root> <priority value="INFO" /> <appender-ref ref="INFO" /> <appender-ref ref="WARN" /> <appender-ref ref="HIGHLIGHT" /> <appender-ref ref="STDOUT" /> </root> </log4j:configuration>
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"> <log4j:configuration xmlns:log4j=‘http://jakarta.apache.org/log4j/‘ > <appender name="myConsole" class="org.apache.log4j.ConsoleAppender"> <layout class="org.apache.log4j.PatternLayout"> <param name="ConversionPattern" value="log4j:%m-[%d{yyyy-MM-dd HH:mm:ss\} %l ]%n" /> </layout> <!--过滤器设置输出的级别--> <!-- <filter class="org.apache.log4j.varia.LevelRangeFilter"> <param name="levelMin" value="debug" /> <param name="levelMax" value="warn" /> <param name="AcceptOnMatch" value="true" /> </filter> --> </appender> <!-- <appender name="myFile" class="org.apache.log4j.DailyRollingFileAppender"> <param name="File" value="D:\\log\\test.log" />设置日志输出文件名 <param name="encoding" value="UTF-8" /> <param name="DatePattern" value="‘.‘yyyy-MM-dd‘.log‘" /> 设置是否在重新启动服务时,在原有日志的基础添加新日志 <param name="Append" value="true" /> <layout class="org.apache.log4j.PatternLayout"> <param name="ConversionPattern" value="[%d{yyyy-mm-dd HH:mm:ss,SSSS\} %l ]-%m%n" /> </layout> </appender> --> <appender name="myFile" class="org.apache.log4j.DailyRollingFileAppender"> <param name="Threshold" value="info"></param> <param name="ImmediateFlush" value="true"></param> <param name="File" value="D:/logs/auto_test.log"></param> <param name="DatePattern" value="‘.‘yyyy-MM-dd‘.log‘"></param> <layout class="org.apache.log4j.PatternLayout"> <param name="ConversionPattern" value="[%d{yyyy-MM-dd HH:mm:ss\} %l ]-%m%n" /> <!-- <param name="ConversionPattern" value="[%d{yyyy-mm-dd HH:mm:ss\} %-5p] [%t] {%c:%L}-%m%n"></param> --> </layout> </appender> <!-- <appender name="activexAppender" class="org.apache.log4j.DailyRollingFileAppender"> <param name="File" value="D:\\log\\activex.log" /> <param name="DatePattern" value="‘.‘yyyy-MM-dd‘.log‘" /> <layout class="org.apache.log4j.PatternLayout"> <param name="ConversionPattern" value="[%d{MMdd HH:mm:ss SSS\} %-5p] [%t] %c{3\} - %m%n" /> </layout> </appender> --> <!-- 指定logger的设置,additivity指示是否遵循缺省的继承机制--> <!-- <logger name="com.test" additivity="false"> <priority value ="info"/> <appender-ref ref="myConsole" /> </logger> <logger name="response" additivity="true"> <level value="ERROR" /> <appender-ref ref="A1" /> </logger> --> <!-- <logger name="com.test" additivity="false"> <priority value ="info"/> <appender-ref ref="myFile" /> </logger> --> <category name="com.test" additivity="false"> <priority value="info"/> <appender-ref ref="myConsole"/> <appender-ref ref="myFile"/> </category> <!-- 根logger的设置--> <root> <priority value ="info"/> <appender-ref ref="myConsole"/> <appender-ref ref="myFile"/> </root> </log4j:configuration>
标签:pattern 继承 max div activex bug imm debug oct
原文地址:http://www.cnblogs.com/testway/p/6232228.html