log4j日志分类有什么?

log4j日志分类有什么?

/-----------------------------------------------------------------------------------------------------------------------------------------------------/

<?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 %d{MM月dd号 HH:mm} %-36c %5L %m%n" />
</layout>
</appender -->

<!--把INFO信息输出到控制台-->
<appender name="INFOConsole"
class="org.apache.log4j.ConsoleAppender">
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%-5p %d{MM月dd号 HH:mm} %-36c %5L %m%n"/>
</layout>
<filter class="org.apache.log4j.varia.LevelRangeFilter">
<param name="LevelMin" value="INFO" />
<param name="LevelMax" value="INFO" />
</filter>
</appender>

<!--把WARN信息输出到控制台-->

<appender name="WARNConsole"
class="org.apache.log4j.ConsoleAppender">
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%-5p %d{MM月dd号 HH:mm} %-36c %5L %m%n"/>
</layout>
<filter class="org.apache.log4j.varia.LevelRangeFilter">
<param name="LevelMin" value="WARN" />
<param name="LevelMax" value="WARN" />
</filter>
</appender>

<!--把ERROR信息输出到控制台-->

<appender name="ERRORConsole"
class="org.apache.log4j.ConsoleAppender">
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%-5p %d{MM月dd号 HH:mm} %-36c %5L %m%n"/>
</layout>
<filter class="org.apache.log4j.varia.LevelRangeFilter">
<param name="LevelMin" value="ERROR" />
<param name="LevelMax" value="ERROR" />
</filter>
</appender>
 

<!--把DEBUG信息输出到日志文件-->

<appender name="DEBUG"
class="org.apache.log4j.RollingFileAppender">
<param name="File" value="//log//debug.log" />
<param name="Append" value="false" />
<param name="MaxFileSize" value="2000KB" />
<param name="MaxBackupIndex" value="2" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%-5p %d{MM月dd号 HH:mm} %-36c %m%n"/>
</layout>
<filter class="org.apache.log4j.varia.LevelRangeFilter">
<param name="LevelMin" value="DEBUG" />
<param name="LevelMax" value="DEBUG" />
</filter>
</appender>

<!--把INFO信息输出到日志文件-->

<appender name="INFO"
class="org.apache.log4j.RollingFileAppender">
<param name="File" value="//log//info.log" />
<param name="Append" value="false" />
<param name="MaxFileSize" value="500KB" />
<param name="MaxBackupIndex" value="2" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%-5p %d{MM月dd号 HH:mm} %-36c %5L %m%n"/>
</layout>
<filter class="org.apache.log4j.varia.LevelRangeFilter">
<param name="LevelMin" value="INFO" />
<param name="LevelMax" value="INFO" />
</filter>
</appender>

<!--把WARN信息输出到日志文件-->

<appender name="WARN"
class="org.apache.log4j.RollingFileAppender">
<param name="File" value="//log//warn.log" />
<param name="Append" value="false" />
<param name="MaxFileSize" value="500KB" />
<param name="MaxBackupIndex" value="2" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%-5p %d{MM月dd号 HH:mm} %-36c %5L %m%n"/>
</layout>
<filter class="org.apache.log4j.varia.LevelRangeFilter">
<param name="LevelMin" value="WARN" />
<param name="LevelMax" value="WARN" />
</filter>
</appender>

<!--把ERROR信息输出到日志文件-->

<appender name="ERROR"
class="org.apache.log4j.RollingFileAppender">
<param name="File" value="//log//error.log" />
<param name="Append" value="false" />
<param name="MaxFileSize" value="500KB" />
<param name="MaxBackupIndex" value="2" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%-5p %d{MM月dd号 HH:mm} %-36c %5L %m%n"/>
</layout>
<filter class="org.apache.log4j.varia.LevelRangeFilter">
<param name="LevelMin" value="ERROR" />
<param name="LevelMax" value="ERROR" />
</filter>
</appender>


<!--把INFO信息输出到数据库中-->
<!-- appender name="INFOJDBC"
class="org.apache.log4j.jdbc.JDBCAppender">
<param name="URL" value="jdbc:mysql://127.0.0.1:3306/jxcpa?useUincode=true&amp;characterEncoding=GBK" />
<param name="driver" value="com.mysql.jdbc.Driver" />
<param name="user" value="root" />
<param name="password" value="" />

<param name="sql" value="insert into logs (level,creatdate,class,num,message) values (/'%p/',/'%d/',/'%c/',/'%L/',/'%m/')" />

</appender -->

<!--把WARN信息输出到数据库中-->

<appender name="WARNJDBC"
class="org.apache.log4j.jdbc.JDBCAppender">
<param name="URL" value="jdbc:mysql://127.0.0.1:3306/jxcpa?useUincode=true&amp;characterEncoding=GBK" />
<param name="driver" value="com.mysql.jdbc.Driver" />
<param name="user" value="root" />
<param name="password" value="" />

<param name="sql" value="insert into logs (level,creatdate,class,num,message) values (/'%p/',/'%d/',/'%c/',/'%L/',/'%m/')" />

</appender>

<!--把ERROR信息输出到数据库中-->

<appender name="ERRORJDBC"
class="org.apache.log4j.jdbc.JDBCAppender">
<param name="URL" value="jdbc:mysql://127.0.0.1:3306/jxcpa?useUincode=true&amp;characterEncoding=GBK" />
<param name="driver" value="com.mysql.jdbc.Driver" />
<param name="user" value="root" />
<param name="password" value="" />

<param name="sql" value="insert into logs (level,creatdate,class,num,message) values (/'%p/',/'%d/',/'%c/',/'%L/',/'%m/')" />

</appender>

<root>
<priority value="debug" />
<!-- appender-ref ref="STDOUT" /-->
<appender-ref ref="INFOConsole" />
<appender-ref ref="WARNConsole" />
<appender-ref ref="ERRORConsole" />
<appender-ref ref="DEBUG" />
<appender-ref ref="INFO" />
<appender-ref ref="WARN" />
<appender-ref ref="ERROR" />
<!--appender-ref ref="INFOJDBC" /-->
<appender-ref ref="WARNJDBC" />
<appender-ref ref="ERRORJDBC" />
</root>

</log4j:configuration>

/----------------------------------------------------------------------------------------------------------------------------------------------------/