logging-log4cxx-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yiannis Feidaros <jf...@freemail.gr>
Subject How to use %F %L?
Date Mon, 28 Jun 2004 10:17:24 GMT
Hi all,

The conversion characters (%F: %L) return (:-1) when using them. What 
might be wrong?
I' using the "trivial" example bundled with the download package. Below 
is the code:

#include <stdlib.h>
#include <log4cxx/logger.h>
#include <log4cxx/basicconfigurator.h>
#include <log4cxx/propertyconfigurator.h>
#include <log4cxx/helpers/exception.h>
#include <log4cxx/ndc.h>

using namespace log4cxx;
using namespace log4cxx::helpers;

int main()
{
    int result = EXIT_SUCCESS;
    try
    {
        LoggerPtr logger = Logger::getLogger(_T("main"));
        String propertyFileName = _T("log.properties");
        PropertyConfigurator::configure(propertyFileName);

        logger->debug(_T("debug message"));
        logger->info(_T("info message"));
        logger->warn(_T("warn message"));
        logger->error(_T("error message"));
        logger->fatal(_T("fatal message"));
    }
    catch(Exception&)
    {
        result = EXIT_FAILURE;
    }

    return result;
}


and here is the contents of the configuration file "log.properties":

log4j.logger.main=DEBUG, A1

log4j.appender.A1=org.apache.log4j.RollingFileAppender
log4j.appender.A1.File=trivial.log.txt
log4j.appender.A1.MaxFileSize=100KB
log4j.appender.A1.MaxBackupIndex=1

log4j.appender.A1.layout=org.apache.log4j.PatternLayout
log4j.appender.A1.layout.ConversionPattern=[%c] %d{%d-%m-%Y %H:%M:%S} 
(%F:%L)%n

the output of the "trivial.log.txt" file:

[main] 28-06-2004 13:10:45 (:-1)
[main] 28-06-2004 13:10:45 (:-1)
[main] 28-06-2004 13:10:45 (:-1)
[main] 28-06-2004 13:10:45 (:-1)
[main] 28-06-2004 13:10:45 (:-1)


my build system is Win2k, MSVC 7.1, unicode debug target (both library 
and trivial)

Thank you, yiannis


____________________________________________________________________
http://www.freemail.gr - δωρεάν υπηρεσία ηλεκτρονικού ταχυδρομείου.
http://www.freemail.gr - free email service for the Greek-speaking.

Mime
View raw message