log4j的配置文件-全(转)
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"> <!-- Log4j Configuration --> <!-- | For more configuration infromation and examples see the Jakarta Log4j | owebsite: http://jakarta.apache.org/log4j --> <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false"> <!-- =================Appenders for CSF=================--> <appender name="CSF_FILE" class="org.apache.log4j.RollingFileAppender"> <param name="Threshold" value="INFO"/> <param name="File" value="C:/jboss-3.2.1/server/default/log/csf.log"/> <param name="Append" value="true"/> <param name="MaxFileSize" value="500KB"/> <param name="MaxBackupIndex" value="1"/> <layout class="org.apache.log4j.PatternLayout"> <param name="ConversionPattern" value="%d %-5p [%c] %m%n"/> </layout> </appender> <!-- Mail Appender --> <appender name="CSF_SMTP" class="org.apache.log4j.net.SMTPAppender"> <param name="Threshold" value="FATAL"/> <param name="To" value=""/> <param name="From" value=""/> <param name="Subject" value="One Fatal Error"/> <param name="SMTPHost" value=""/> <param name="BufferSize" value="10"/> <layout class="org.apache.log4j.PatternLayout"> <param name="ConversionPattern" value="[%d{ABSOLUTE},%c{1}] %m%n"/> </layout> </appender> <!--JDBC--> <appender name="CSF_JDBC" class="org.apache.log4j.jdbc.JDBCAppender"> <param name="Threshold" value="ERROR"/> <param name="driver" value="com.sybase.jdbc2.jdbc.SybDriver"/> <param name="URL" value="jdbc:sybase:Tds:127.0.0.1:2638/Summit"/> <param name="user" value="DBA"/> <param name="password" value="SQL"/> <layout class="org.apache.log4j.PatternLayout"> <param name="ConversionPattern" value="INSERT INTO ErrorLog (ErrorMessage) VALUES ('%d - %c - %p - %m')"/> </layout> </appender> <!--=================End Appenders for CSF================= --> <!-- =================Appenders for Events=================--> <appender name="EVENT_FILE" class="org.apache.log4j.RollingFileAppender"> <param name="Threshold" value="INFO"/> <param name="File" value="C:/jboss-3.2.1/server/default/log/event.log"/> <param name="Append" value="true"/> <param name="MaxFileSize" value="500KB"/> <param name="MaxBackupIndex" value="1"/> <layout class="org.apache.log4j.PatternLayout"> <param name="ConversionPattern" value="%d %-5p [%c] %m%n"/> </layout> </appender> <!-- Mail Appender --> <appender name="EVENT_SMTP" class="org.apache.log4j.net.SMTPAppender"> <param name="Threshold" value="FATAL"/> <param name="To" value=""/> <param name="From" value=""/> <param name="Subject" value="One Fatal Error"/> <param name="SMTPHost" value=""/> <param name="BufferSize" value="10"/> <layout class="org.apache.log4j.PatternLayout"> <param name="ConversionPattern" value="[%d{ABSOLUTE},%c{1}] %m%n"/> </layout> </appender> <!-- JDBC --> <appender name="EVENT_JDBC" class="org.apache.log4j.jdbc.JDBCAppender"> <param name="Threshold" value="ERROR"/> <param name="driver" value="com.sybase.jdbc2.jdbc.SybDriver"/> <param name="URL" value="jdbc:sybase:Tds:127.0.0.1:2638/Summit"/> <param name="user" value="DBA"/> <param name="password" value="SQL"/> <layout class="org.apache.log4j.PatternLayout"> <param name="ConversionPattern" value="INSERT INTO ErrorLog (ErrorMessage) VALUES ('%d - %c - %p - %m')"/> </layout> </appender> <!--=================End Appenders for Event================= --> <!-- Append messages to the console --> <!-- <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender"> <param name="Target" value="System.out"/> <param name="Threshold" value="INFO"/> <layout class="org.apache.log4j.PatternLayout"> The default pattern: Date Priority [Category] Message\n <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%c{1}] %m%n"/> </layout> </appender> <appender name="JSR77" class="org.apache.log4j.FileAppender"> <param name="Append" value="false"/> <param name="File" value="/log/jsr77.log"/> <layout class="org.apache.log4j.PatternLayout"> <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%c{1}] %m%n"/> </layout> </appender> --> <!-- More Appender --> <!-- Buffer events and log them asynchronously --> <appender name="ASYNC" class="org.apache.log4j.AsyncAppender"> <appender-ref ref="CSF_FILE"/> <appender-ref ref="CSF_JDBC"/> <appender-ref ref="CSF_SMTP"/> <appender-ref ref="EVENT_FILE"/> <appender-ref ref="EVENT_JDBC"/> <appender-ref ref="EVENT_SMTP"/> </appender> <!-- Limit categories --> <!-- Limit categories to INFO <category name=""> <priority value="INFO"/> </category> --> <!-- RULES for logging DEBUG < INFO < WARN < ERROR < FATAL. --> <!-- tested and run--> <category name="com.one.events" additivity="false"> <priority value="INFO"/> <appender-ref ref="EVENT_FILE"/> <appender-ref ref="EVENT_JDBC"/> <appender-ref ref="EVENT_SMTP"/> </category> <category name="com.one.csf" additivity="false"> <priority value="INFO"/> <appender-ref ref="CSF_FILE"/> <appender-ref ref="CSF_JDBC"/> <appender-ref ref="CSF_SMTP"/> </category> <!-- Decrease the priority threshold <category name=""> <priority value="DEBUG"/> </category> --> <!-- Setup the Root category --> <root> <appender-ref ref="ASYNC"/> </root> </log4j:configuration>
相关推荐
chw0 2020-11-04
大唐帝国前营 2020-08-18
sdaq 2020-07-26
MrLiar 2020-07-07
sdaq 2020-06-16
CXC0 2020-06-14
丨Fanny丨Cri 2020-06-13
CXC0 2020-06-08
dongxurr 2020-06-07
sdaq 2020-06-06
MrLiar 2020-06-04
丨Fanny丨Cri 2020-06-03
MrLiar 2020-05-25
丨Fanny丨Cri 2020-05-17
MrLiar 2020-05-14
MrLiar 2020-05-12
sdaq 2020-05-11