logging-log4cxx-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jing Zheng <jingzh...@inbox.com>
Subject RE: DailyRollingFileAppender doesn't work gcc 3.2.2 RHEL3
Date Thu, 26 Oct 2006 04:08:12 GMT
looks like RollingFileAppener with TimeBasedPolicy is an alternative to this problem.
http://www.mail-archive.com/log4cxx-user@logging.apache.org/msg01626.html

thank Curt for this one :-)
> -----Original Message-----
> From: jingzheng@inbox.com
> Sent: Wed, 25 Oct 2006 16:36:08 -0700 (PDT)
> To: log4cxx-user@logging.apache.org
> Subject: DailyRollingFileAppender doesn't work gcc 3.2.2 RHEL3
> 
> 
> $trivial log4j.xml
> $log4cxx: No output stream or file set for the appender named
> [DATE_LOGFILE].
> 
> I am using the trial.cpp under example dir to test. the only change I
> made
> is to use "xml::DOMConfigurator::configure(argv[1])", instead of
> "BasicConfigurator::configure()".
> 
> log4j.xml:
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
> 
> <log4j:configuration xmlns:log4j='http://jakarta.apache.org/log4j/'>
> 
>     <appender name="DATE_LOGFILE"
> class="org.apache.log4j.DailyRollingFileAppender">
>         <param name="Append" value="true" />
>         <param name="File" value="log4cxx.test.log" />
>         <param name="datePattern" value="'.'yyyy-MM-dd" />
> 
>         <layout class="org.apache.log4j.PatternLayout">
>             <param name="ConversionPattern" value="%d %-5p [%t] %C{2}
> (%F:%L) - %m%n"/>
>         </layout>
>    </appender>
> 
>    <root>
>         <priority value="DEBUG"/>
>         <appender-ref ref="DATE_LOGFILE"/>
>    </root>
> 
> </log4j:configuration>
> 
> trivial.cpp:
> #include <log4cxx/logstring.h>
> #include <stdlib.h>
> #include <log4cxx/logger.h>
> #include <log4cxx/basicconfigurator.h>
> #include <log4cxx/xml/domconfigurator.h>
> #include <log4cxx/helpers/exception.h>
> #include <log4cxx/ndc.h>
> 
> using namespace log4cxx;
> using namespace log4cxx::helpers;
> 
> namespace {
>     LoggerPtr logger = Logger::getRootLogger();
> }
> 
> int main(int argc, char *argv[])
> {
>     int result = EXIT_SUCCESS;
>     try {
>         if (argc > 1) {
>             // BasicConfigurator replaced with PropertyConfigurator.
>             xml::DOMConfigurator::configure(argv[1]);
>         } else {
>             BasicConfigurator::configure();
>         }
> 
>         NDC::push("trivial context");
> 
>         LOG4CXX_DEBUG(logger, "debug message");
>         LOG4CXX_INFO(logger, "info message");
>         LOG4CXX_WARN(logger, "warn message");
>         LOG4CXX_ERROR(logger, "error message");
>         LOG4CXX_FATAL(logger, "fatal message");
> 
>         NDC::pop();
>     } catch(std::exception&) {
>         result = EXIT_FAILURE;
>     }
> 
>     return result;
> }
> 
> I tried the same log4j.xml with log4j-1.2.14.jar and java code works.
> 
> anyone has a successful example for log4cxx DailyRollingFileAppender?
> thanks
> in advance for any help.
> --
> View this message in context:
> http://www.nabble.com/DailyRollingFileAppender-doesn%27t-work-gcc-3.2.2-RHEL3-tf2510954.html#a7002628
> Sent from the Log4cxx - Users mailing list archive at Nabble.com.

____________________________________________________________
GET FREE 5GB ONLINE STORAGE - Safely store your documents, photos and music online!
Visit http://www.inbox.com/storage to find out more!

Mime
View raw message