Apache Log4cxx  Version 1.3.0
Loading...
Searching...
No Matches
custom-appender.xml

This example shows how to use a new appender in a configuration file.

1<?xml version="1.0" encoding="UTF-8" ?>
2<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
3 <appender name="ConsoleAppender" class="org.apache.log4j.ConsoleAppender">
4 <param name="Target" value="System.out"/>
5 <layout class="org.apache.log4j.PatternLayout">
6 <param name="ConversionPattern" value="[%d{yyyy-MM-dd HH:mm:ss}] %c %-5p - %m%n"/>
7 </layout>
8 </appender>
9
10 <appender name="NullAppender" class="NullWriterAppender">
11 <param name="SomeValue" value="Nothing"/>
12 </appender>
13
14 <root>
15 <priority value="info" />
16 <appender-ref ref="ConsoleAppender"/>
17 </root>
18
19 <logger name="NullLogger" additivity="false">
20 <appender-ref ref="NullAppender"/>
21 </logger>
22</log4j:configuration>