I have been unable to get the AsyncAppender to work. For every appender
that is added to the AsyncAppender, the following error message appears:
No appender named [<name>] could be found.
And not surprisingly, no logging happens.
I whittled this down to a simple example using an AsyncAppender with two
attached appenders. Here is the config file:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration xmlns:log4j='http://jakarta.apache.org/log4j/'
debug="true">
<appender name="CONSOLE"
class="org.apache.log4j.ConsoleAppender">
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern"
value="%d [%t] %-5p %c - %m%n" />
</layout>
</appender>
<appender name="FILE"
class="org.apache.log4j.FileAppender">
<param name="File" value="Sample.log" />
<param name="Append" value="false" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern"
value="%d [%t] %-5p %c - %m%n" />
</layout>
</appender>
<appender name="ASYNC"
class="org.apache.log4j.AsyncAppender">
<param name="LocationInfo" value="true" />
<appender-ref ref="CONSOLE" />
<appender-ref ref="FILE" />
</appender>
<root>
<level value="debug" />
<appender-ref ref="ASYNC" />
</root>
</log4j:configuration>
And here is the log4cxx debug output:
log4cxx: Threshold ="".
log4cxx: Level value for root is [debug].
log4cxx: OptionConverter::toLevel: no class name specified,
level=[debug]
log4cxx: root level set to DEBUG
log4cxx: Class name: [org.apache.log4j.AsyncAppender]
log4cxx: Setting option name=[LocationInfo], value=[true]
log4cxx: Attaching appender named [CONSOLE] to appender named
[ASYNC].
log4cxx: No appender named [CONSOLE] could be found.
log4cxx: Attaching appender named [FILE] to appender named [ASYNC].
log4cxx: No appender named [FILE] could be found.
log4cxx: Adding appender named [ASYNC] to logger [root].
When I change the root logger's appender from "ASYNC" to "CONSOLE" or
"FILE"
(i.e., bypassing the AsyncAppender), then everything works fine.
Am I doing something wrong here?
I am using log4cxx 0.10.0,
taken from <http://littletux.homelinux.org/log4cxx> on June 21.
I am running Windows XP SP2, with Visual C++ 6.0 SP6.
Thanks,
Moshe