log4j: WARN No appenders could be found for logger (org.activemq.transport.tcp.TcpTransportChannel).
log4j: WARN Please initialize the log4j system properly.
If you are getting foregoing log4j warn debug info, that means you have not initialized log4j properly. So In this part of tutorial we will tell you how to configure log4j using BasicConfigurator.
Now lets see when this log4j warning occurs. We are creating only SimpleLog file without configuring it as:
After running the example we have got following log4j warning flashing on command prompt:
log4j:WARN No appenders
could be found for logger (SimpleLog.class).
It is because we don't have configured Log4j. There are many different ways of configuring Log4j. One way is through BasicConfigurator. This can be done as follows:
Now after running this code you will get the following output on your console:
|0 [main] DEBUG SimpleLog.class - Hello world.|
where "0" shows time taken in
milliseconds from start of program to the logging request. "Hello
world" is the message that we have given.
SimpleLog.class is the logger name and in bracket [main] is the thread who have invoked logging.
Rs. 20,000 US$ 300
Today: Rs. 10,000 US$150
Course Duration: 30 hrs
Posted on: September 10, 2008 If you enjoyed this post then why not add us on Google+? Add us to your Circles