logging-log4cxx-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From George Uecker <george.uec...@dot21rts.com>
Subject Re: AsyncAppender not working
Date Tue, 26 Jun 2007 13:39:35 GMT
Moshe,

Here's a copy of my config file.  It configures two different AsyncAppenders, one for the
ConsoleAppender and one for our custom DDSAppender.  (The one shown for the FileAppender is
commented out in the root section.) Works fine.

HTH,

George


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE log4cxx:configuration >

<log4cxx:configuration xmlns:log4cxx="http://jakarta.apache.org/log4cxx/"
                configDebug="true">

        <appender name="ASYNC_CONSOLE" class="org.apache.log4cxx.AsyncAppender">
                <appender-ref ref="CONSOLE"/>
        </appender>

        <appender name="ASYNC_DDS" class="org.apache.log4cxx.AsyncAppender">
                <appender-ref ref="DDS"/>
        </appender>

        <!--appender name="ASYNC_FILE" class="org.apache.log4cxx.AsyncAppender">
                <appender-ref ref="FILE"/>
        </appender-->

        <appender name="CONSOLE" class="org.apache.log4cxx.ConsoleAppender">
                <layout class="org.apache.log4cxx.PatternLayout">
                     <param name="ConversionPattern"
                            value="%d %-5p [%x] %C{2} (%F:%L) - %m%n"/>
                </layout>
        </appender>

        <appender name="DDS" class="org.apache.log4cxx.DDSAppender">
                <param name="domain" value="21"/>
                <!--DDSAppender has no Layout-->
                <!--layout class="org.apache.log4cxx.PatternLayout">
                     <param name="ConversionPattern"
                            value="%d %-5p [%t] %C{2} (%F:%L) - %m%n"/>
                </layout-->
        </appender>

        <appender name="FILE" class="org.apache.log4cxx.FileAppender">
                <param name="File" value="tempLogFile"/>
                <layout class="org.apache.log4cxx.PatternLayout">
                     <param name="ConversionPattern"
                            value="%d %-5p [%t] %C{2} (%F:%L) - %m%n"/>
                </layout>
        </appender>

        <root>
                <priority value="debug"/>
                <appender-ref ref="ASYNC_CONSOLE"/>
                <appender-ref ref="ASYNC_DDS"/>
                <!--appender-ref ref="FILE"/-->
        </root>
</log4cxx:configuration>



Moshe Matitya wrote:
> Unless I'm missing something, it appears to be impossible to configure
> log4cxx to use AsyncAppender.  Is there anybody out there who has
> actually used it?  If so, can you show me how your config file looks?
> 
> Thanks,
> 
> Moshe
> 
> 
> 
>>-----Original Message-----
>>From: Moshe Matitya [mailto:Moshe.Matitya@Kayote.com] 
>>Sent: Thursday, June 21, 2007 8:40 PM
>>To: log4cxx-user@logging.apache.org
>>Subject: AsyncAppender not working
>>
>>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
> 
> 
> 


Mime
View raw message