This example shows a configuration using the asynchronous appender.
1<?xml version="1.0" encoding="UTF-8" ?>
2<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
3 <appender name="A1" class="RollingFileAppender">
4 <param name="File" value="${TEMP}/SomeApplicationName.log" />
5 <param name="Append" value="true" />
6 <layout class="PatternLayout">
7 <param name="ConversionPattern" value="%d %-5p %c{2} - %m%n"/>
8 </layout>
9 </appender>
10 <appender name="SENDMAIL" class="SMTPAppender">
11 <param name="from" value="service_name@example.org" />
12 <param name="to" value="some_support_group@example.org" />
13 <param name="subject" value="Service error detected" />
14 <param name="SMTPHost" value="smtp.example.com"/>
15 <layout class="PatternLayout">
16 <param name="ConversionPattern" value="%-5p %c{2} - %m%n"/>
17 </layout>
18
19
20 </appender>
21 <appender name="ASYNC" class="AsyncAppender">
22 <param name="BufferSize" value="1000"/>
23 <param name="Blocking" value="false"/>
24 <appender-ref ref="SENDMAIL"/>
25 </appender>
26 <root>
27 <priority value ="INFO" />
28 <appender-ref ref="A1" />
29 <appender-ref ref="ASYNC" />
30 </root>
31</log4j:configuration>