Hello,
 
this is the first time I use the AsyncAppender. If I try to add one or
more appender to the AsyncAppender this fails with the message 'No
appender named [FILE] could be found.'. I use log4cxx latest from SVN on
Windows XP SP2 Visual Studio 2003. Here the complete debug log:

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: Attaching appender named [FILE] to appender named [ASYNC].
log4cxx: No appender named [FILE] could be found.
log4cxx: Attaching appender named [CONSOLE] to appender named [ASYNC].
log4cxx: No appender named [CONSOLE] could be found.
log4cxx: Adding appender named [ASYNC] to logger [root].

And here the configuration I use:

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">

<log4j:configuration debug="true"
xmlns:log4j='http://jakarta.apache.org/log4j/'>

  <appender name="ASYNC" class="org.apache.log4j.AsyncAppender">
    <appender-ref ref="FILE" />
    <appender-ref ref="CONSOLE" />
  </appender>

  <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>

  <root>
    <level value ="debug"/>
    <appender-ref ref="ASYNC" />
  </root>  
</log4j:configuration>

If there is no AsyncAppender like in the following config it logs to
console and file:

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">

<log4j:configuration debug="true"
xmlns:log4j='http://jakarta.apache.org/log4j/'>

  <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>

  <root>
    <level value ="debug"/>
    <appender-ref ref="CONSOLE" />
    <appender-ref ref="FILE" />
  </root>  
</log4j:configuration>

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.ConsoleAppender]
log4cxx: Parsing layout of class: "org.apache.log4j.PatternLayout"
log4cxx: Setting option name=[ConversionPattern], value=[%d [%t] %-5p %c
- %m%n]
log4cxx: Adding appender named [CONSOLE] to logger [root].
log4cxx: Class name: [org.apache.log4j.FileAppender]
log4cxx: Setting option name=[File], value=[sample.log]
log4cxx: Setting option name=[Append], value=[false]
log4cxx: Parsing layout of class: "org.apache.log4j.PatternLayout"
log4cxx: Setting option name=[ConversionPattern], value=[%d [%t] %-5p %c
- %m%n]
log4cxx: Adding appender named [FILE] to logger [root].


Why is it not possible to me to add appender to the AsyncAppender????
I tried to change the order of the appender in the config file but this
did not help.


Thanks for help!

Christian

Reply via email to