views:

165

answers:

2

I am receiving this warning which interrupts the running of my web application.

    log4j:WARN No appenders could be found for logger (smslib).
    log4j:WARN Please initialize the log4j system properly.

I have the log4j JAR file in my library. I have deleted it and added it again ... this warning keeps showing up.

Thanks for your time,

+1  A: 

Well log4j is clearly being found, otherwise it couldn't be warning you like this!

What's more likely to be missing is a log4j configuration. There are lots of ways you can do this in a web application - how are you trying?

Jon Skeet
I just tried running the application again and it ran just fine!! I think my netbeans has the problems! Thanks
Saher
+2  A: 

For small stand-alone programs and unit tests, I use BasicConfigurator.

To init:

BasicConfigurator.configure();

To cleanup:

BasicConfigurator.resetConfiguration();

If you're using JUnit, you should generally remember to place the cleanup code in your @After/tearDown(), since the configure() method adds a console appender if log4j had already been initialized.

Alex Arnon