logging-log4cxx-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Fabijan...@nucorsteel.com
Subject A Newbie Question About Examples
Date Wed, 21 Jul 2004 14:42:39 GMT

 I am not able to run the examples from the introduction document (VC++
6.0). Simple copy/paste of the code dies with console error message "You
have tried to set a null level to root.".

I was able to get the app to complete (quick & dirty and the above
mentioned error still prints out) by adding constructor to bar as follows
(code somewhat condensed for brevity) :

Bar::Bar() {
    TTCCLayout* layout = new TTCCLayout;
    ConsoleAppender* console = new ConsoleAppender(layout);

and then modify main as follows:

LoggerPtr rootLogger = Logger::getRootLogger();

int main(int argc, char **argv) {
        LoggerPtr logger = Logger::getLogger(_T("MyApp"));
        int result = EXIT_SUCCESS;
        try    {
                logger->info(_T("Entering application."));
                Bar bar;
                logger->info(_T("Exiting application."));
        catch(Exception&)        {
                result = EXIT_FAILURE;
        return result;

Any help appreciated.

Aleksandar Fabijanic
Level 2 Automation Engineer
Nucor Steel Berkeley - Beam Mill
Phone: 843.336.6678
Fax:      843.336.6072

View raw message