sorry, posted to wrong forum. reposted to user forum. Jing Zheng wrote: > > $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-tf2510930.html#a7002630 Sent from the Log4cxx - Dev mailing list archive at Nabble.com.
