Fixed.

Was a problem with the built libraries I was using.

I simply rebuilt the project and now work! 

 

Matt Zmuda

Software Developer - Tools Group

________________________________

From: Zmuda, Matthew [mailto:matthew_zm...@tvworks.com] 
Sent: September 25, 2009 8:20 AM
To: Log4CXX User
Subject: RE: log4cxx with JNI... Crashes when using appender and layout?

 

I wanted to add to this issue.

I noticed the error only occurs once the app finishes running, so probably when 
the DLL is unloading and there is some cleaning occurring.

Should I be doing any cleanup from the below code? I didn't look into it much 
yet but it seems that all the XxxxxPtr classes are smart pointers?

And from examples I've seen there has been no cleanup.

 

Thanks,

 

Matt Zmuda

Software Developer - Tools Group

________________________________

From: Zmuda, Matthew [mailto:matthew_zm...@tvworks.com] 
Sent: September 24, 2009 5:38 PM
To: log4cxx-user@logging.apache.org
Subject: log4cxx with JNI... Crashes when using appender and layout?

 

When calling native code from java the following works when making the native 
calls:

    BasicConfigurator::configure();

    LoggerPtr rootLogger = Logger::getRootLogger();

    LOG4CXX_DEBUG(rootLogger, "debug message");

    LOG4CXX_INFO(rootLogger, "info message");

    LOG4CXX_WARN(rootLogger, "warn message");

    LOG4CXX_ERROR(rootLogger, "error message");

    LOG4CXX_FATAL(rootLogger, "fatal message");

If I try setting appender and layout like:

    LoggerPtr rootLogger = Logger::getRootLogger();

        log4cxx::ConsoleAppenderPtr appender(new log4cxx::ConsoleAppender());

        log4cxx::LayoutPtr layout(new log4cxx::SimpleLayout());

    appender->setLayout(layout);

        log4cxx::helpers::Pool pool;

    appender->activateOptions(pool);

        rootLogger->addAppender(appender);

        LogManager::getLoggerRepository()->setConfigured(true);

    LOG4CXX_DEBUG(rootLogger, "debug message");

    LOG4CXX_INFO(rootLogger, "info message");

    LOG4CXX_WARN(rootLogger, "warn message");

    LOG4CXX_ERROR(rootLogger, "error message");

    LOG4CXX_FATAL(rootLogger, "fatal message");

I get memory could not be "written" Application error and JVM crashes.  The 
messages show up in proper format and all but after that what I get.

Any ideas?

Matt Zmuda

Software Developer - Tools Group

TVWorks - Platform Division, London, Canada

(519) 963-4304

Reply via email to