Log4J configuration

Hi !
I'm using Apache Log4J 1.2.7 in my project and get
"log4j:WARN No appenders could be found for logger (my.class.name).
log4j:WARN Please initialize the log4j system properly.
"
when start to debug/run the project.

I have included

to VM parameters (in Run/Debug project properties)

What sould I do to enable log4j usage in my project ?
Windows XP / IntelliJ Idea 3.0 build 676 / jsdk 1.4.1

Thanks.

0
3 comments

Hello,
You must use path for -Dlog4j.configuration=file:conf/log4j.properties
There conf is under working directory of process

Better case - just put log4j.properties in classpath root, Log4J find it authomatically.

0
Avatar
Chernyshenko Dmitry

Are you running your program with the JUnit GUI runner? I had a problem with log4j, there was a similar error message. The problem was because appenders specified in the config file were instantiated using the thread context loader, which was different from the loader used by JUnit to load Appender interface itself. The solution was to define
-Dlog4j.ignoreTCL=true
(or something similar, I don't have the project at hand to check).

0
Avatar
Igor A Medyannikov

It works,
thanks.

0

Please sign in to leave a comment.