${openfireHome}/lib/log4j.xmlapache
- <?xml version="1.0" encoding="UTF-8" ?>
- <!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
-
- <log4j:configuration>
-
- <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
- <layout class="org.apache.log4j.PatternLayout">
- <param name="ConversionPattern"
- value="%d - %c -%-4r [%t] %-5p %x - %m%n" />
</layout> 緩存
-
- <!--限制輸出級別-->
- <filter class="org.apache.log4j.varia.LevelRangeFilter">
- <param name="LevelMax" value="ERROR"/>
- <param name="LevelMin" value="TRACE"/>
- </filter>
- </appender>
-
- <appender name="FILE" class="org.apache.log4j.FileAppender">
- <param name="File" value="C:/log4j1.log"/>
- <layout class="org.apache.log4j.PatternLayout">
- <param name="ConversionPattern"
- value="%d - %c -%-4r [%t] %-5p %x - %m%n" />
- </layout>
- </appender>
-
- <appender name="DATABASE" class="org.apache.log4j.jdbc.JDBCAppender">
- <param name="URL" value="jdbc:oracle:thin:@192.168.0.59:1521:oanet"/>
- <param name="driver" value="oracle.jdbc.driver.OracleDriver"/>
- <param name="user" value="hdczoa"/>
- <param name="password" value="system"/>
- <layout class="org.apache.log4j.PatternLayout">
- <param name="ConversionPattern"
- value="INSERT INTO hdczoa.LOG4J(stamp,thread, info_level,class,message) VALUES ('%d', '%t', '%p', '%c', %m)" />
- </layout>
- </appender>
-
- <!-- 發郵件(只有ERROR時纔會發送!) -->
- <appender name="MAIL"
- class="org.apache.log4j.net.SMTPAppender">
- <param name="threshold" value="debug" />
- <!-- 日誌的錯誤級別
- <param name="threshold" value="fatal"/>
- -->
- <!-- 緩存文件大小,日誌達到512K時發送Email -->
- <param name="BufferSize" value="512" /><!-- 單位K -->
- <param name="From" value="test@163.com" />
- <param name="SMTPHost" value="smtp.163.com" />
- <param name="Subject" value="juyee-log4jMessage" />
- <param name="To" value="test@163.com" />
- <param name="SMTPUsername" value="test" />
- <param name="SMTPPassword" value="test" />
- <layout class="org.apache.log4j.PatternLayout">
- <param name="ConversionPattern"
- value="%-d{yyyy-MM-dd HH:mm:ss.SSS} [%p]-[%c] %m%n" />
- </layout>
- </appender>
-
- <appender name="ASYNC" class="org.apache.log4j.AsyncAppender">
- <param name="BufferSize" value="256" />
- <appender-ref ref="DATABASE" />
- </appender>
-
- <!--經過<logger></logger>的定義能夠將各個包中的類日誌輸出到不一樣的日誌文件中-->
- <logger name="com.litt2.log4j" additivity="false">
- <level value="WARN" />
- <appender-ref ref="CONSOLE" />
- </logger>
-
- <!--經過<category></category>的定義能夠將各個包中的類日誌輸出到不一樣的日誌文件中-->
- <category name="com.litt3">
- <level value="DEBUG" />
- <appender-ref ref="CONSOLE" />
- <appender-ref ref="MAIL" />
- </category>
-
- <root>
- <priority value="debug" />
- <appender-ref ref="CONSOLE" />
- <appender-ref ref="FILE" />
- </root>
-
-
- </log4j:configuration>