logging-log4cxx-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jing Zheng <jingzh...@inbox.com>
Subject DailyRollingFileAppender doesn't work gcc 3.2.2 RHEL3
Date Wed, 25 Oct 2006 23:36:08 GMT

$trivial log4j.xml 
$log4cxx: No output stream or file set for the appender named

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

<?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"
        <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"/> 

        <priority value="DEBUG"/> 
        <appender-ref ref="DATE_LOGFILE"/>         

#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. 
        } else { 

        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"); 
    } 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.

View raw message