25 March 2011

how to add log4j.properties to classpath in Netbeans (For java aplication)?

Fancy log4j ?
 Good,because it is cool stuff....
 However ...but when you get started, then everything looks simply and go smoothly until you trying to run application , then  ... you see.

log4j:WARN No appenders could be found for logger (org.my.amazing.application).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.

 No good, then question is Set I everything correctly ?

Below you have receipe how to setup log4j correctly to be DAMN sure, that it will work.

1) add log4j.jar to lib (or any place where you store your libraries

2) and add log4j.properties to <default package> in source Packages.

and btw. make sure that  configure log4j.properties correctly.