You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4cxx-dev@logging.apache.org by Bernard Stumpf <be...@verizon.net> on 2008/03/27 19:31:05 UTC

unable to find sample XML config among log4cxx unit tests

Curt Arnold,

  I have been unable to find sample XML configuration files among the 
log4cxx unit tests or examples.

  I found this file: performance.xml under log4cxx/src/test/resources, 
but it does not seem to have been run by the unit tests, and it has 
references to files like file-noflush.xml which cannot be found in the 
log4cxx tree.

Q1)  Do you know where I could find these, and how log4cxx is configured 
to use one?

Q2)   How does one run the test contained in performance.xml ? It has 
this under <target name="usage">:

      These are the targets supported by this ANT build scpript:
      all - run all performance tests
      null         - run performance tests using NullAppender
      file         - run performance tests using FileAppender
      file-noflush - run performance tests using FileAppender without 
immediate flush
      file-bufferedio - run performance tests using FileAppender without 
buffered IO
      telnet - run performace tests with TelnetAppender

thanks,
-Bernie Stumpf


Re: unable to find sample XML config among log4cxx unit tests

Posted by Curt Arnold <ca...@apache.org>.
On Mar 27, 2008, at 1:31 PM, Bernard Stumpf wrote:
> Curt Arnold,
>
>   I have been unable to find sample XML configuration files among  
> the log4cxx unit tests or examples.
>
>   I found this file: performance.xml under log4cxx/src/test/ 
> resources, but it does not seem to have been run by the unit tests,  
> and it has references to files like file-noflush.xml which cannot be  
> found in the log4cxx tree.
>
> Q1)  Do you know where I could find these, and how log4cxx is  
> configured to use one?
>
> Q2)   How does one run the test contained in performance.xml ? It  
> has this under <target name="usage">:
>
>       These are the targets supported by this ANT build scpript:
>       all - run all performance tests
>       null         - run performance tests using NullAppender
>       file         - run performance tests using FileAppender
>       file-noflush - run performance tests using FileAppender  
> without immediate flush
>       file-bufferedio - run performance tests using FileAppender  
> without buffered IO
>       telnet - run performace tests with TelnetAppender
>
> thanks,
> -Bernie Stumpf
>

Please address your questions to the mailing list, not to any  
individual developer.

I've removed src/test/resources/performance.xml.  I assume it was  
associated with a substantial body of incomplete performance tests  
that were removed in issue LOGCXX-232.


Re: unable to find sample XML config among log4cxx unit tests

Posted by Jostein Tveit <jo...@pvv.ntnu.no>.
Bernard Stumpf <be...@verizon.net> writes:

>   I have been unable to find sample XML configuration files among the
> log4cxx unit tests or examples.

> Q1)  Do you know where I could find these, and how log4cxx is configured
> to use one?

Below is an example of a XML configuration file.

The configuration uses a log file called mylog.log and does a
roll over to a file called mylog.log.yyyy-MM-dd every midnight.

You configure log4cxx to use it with:
log4cxx::xml::DOMConfigurator::configureAndWatch("log4j-config.xml");

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

<log4j:configuration xmlns:log4j='http://logging.apache.org/' debug="false">

  <appender name="applicationLog" class="org.apache.log4j.rolling.RollingFileAppender">
    <rollingPolicy class="org.apache.log4j.rolling.TimeBasedRollingPolicy">
      <param name="fileNamePattern" value="./mylog.log.%d{yyyy-MM-dd}"/>
    </rollingPolicy>
    <layout class="org.apache.log4j.PatternLayout">
      <param name="ConversionPattern" value="%d{yyyy-MM-dd HH:mm:ss,SSS} [%x] [%p] (%F:%L) %m%n"/>
    </layout>
    <param name="file" value="./mylog.log"/>
    <param name="append" value="true"/>
  </appender>

  <logger name="mylog">
    <appender-ref ref="applicationLog"/>
    <level value="INFO"/>
  </logger>

</log4j:configuration>

-- 
Jostein Tveit <jo...@pvv.ntnu.no>