Cristiano Novelli
Java
Section
Menu        
Home
ebXML
CP-NET Project
MSH2
Java
- X-Lab Libraries
- Tutorials
- Links
Links
Information
 

 

 

 

 

 

 

 

 

 

 

 

 

TROUBLE: Logging in Eclipse

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


SOLUTION

15 giugno
enable LOG4J on Eclipse environment

[...]
To initialize the log4j system you have to:
1. create a log4j.properties file like this:

log4j.rootCategory=TRACE, CONSOLE
log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
log4j.appender.CONSOLE.Threshold=INFO
log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
log4j.appender.CONSOLE.layout.ConversionPattern=- %m%n


2. zip the file and rename it .jar (log4jprops.zip => log4jprops.jar), put the file in a folder you like
(example: /workspace/log4jprops/log4jprops.jar)
3. in Eclipse: Run, Debug, click the configuration you want, select Classpath tab
4. click on the User Entries item in the tree view to select it
5. click advanced, select "Add Classpath Variables" radio, and click OK
6. select or create a variable named LOG4J_PROPS, and point it to the JAR created before.

That's all folks!

SOURCE

http://dinolupo.spaces.live.com/Blog/cns!1C808859B4434962!152.entry


e-mail: