logging-log4cxx-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Anoop George Philip <anoopgpm...@yahoo.com>
Subject property configurator is not working fine
Date Mon, 21 Nov 2005 09:30:18 GMT
Hi!

In my project,currently trying to  to implement log4cxx9.8(Using vc++6.0).
Still i cant run even the sample codings given by log4cxx maual.There is no
error displaying,but program is still crashing.I tryed to debug but the
execution would go upto LOG4CXX_INFO(logger, "Entering application."); like
macro statement,then crashed.I dont know what is the problem
sample codings given below
// file MyApp.cpp

#include "com/foo/bar.h"
using namespace com::foo;

// include log4cxx header files.
#include <log4cxx/logger.h>
#include <log4cxx/basicconfigurator.h>
#include <log4cxx/helpers/exception.h>

using namespace log4cxx;
using namespace log4cxx::helpers;

// Define a static logger variable so that it references the
// Logger instance named "MyApp".
LoggerPtr logger(Logger::getLogger("MyApp"));

int main(int argc, char **argv)
{
        int result = EXIT_SUCCESS;
        try
        {
                // Set up a simple configuration that logs on the console.
                BasicConfigurator::configure();

                LOG4CXX_INFO(logger, "Entering application.");
                Bar bar;
                bar.doIt();
                LOG4CXX_INFO(logger, "Exiting application.");
        }
        catch(Exception&)
        {
                result = EXIT_FAILURE;
        }

        return result;


// file <com/foo/bar.h>

#include <log4cxx/logger.h>

namespace com
{
        namespace foo
        {
                class Bar
                {
                        static log4cxx::LoggerPtr logger;

                public:
                        void doIt();
                };
        };
};


// file <bar.cpp>

#include "com/foo/bar.h"

using namespace com::foo;
using namespace log4cxx;

LoggerPtr Bar::logger(Logger::getLogger("com.foo.bar"));

void Bar::doIt()
{
        LOG4CXX_DEBUG(logger, "Did it again!");
}



Thanks in advance



Mime
View raw message