kreetrapper has asked for the wisdom of the Perl Monks concerning the following question:
Dear fellow monks,
I am currently trying to integrate some Java into a perl program and I seem to be stuck. This is the relevant part of my code:
BEGIN { $ENV{CLASSPATH} .= ":log4j.properties:log4j-1.2.14.jar:myclass.jar" +; $ENV{EXTRA_JAVA_ARGS} = "-Dlog4j.debug"; } use Inline Java => 'STUDY', STUDY => ['mypackage.myclass','org.apache.log4j.Logger' +], AUTOSTUDY => 1;
As you can see, the Java code I am trying to integrate uses log4j and that seems to be the problem, because when I run this code I get the following warnings:
log4j:WARN No appenders could be found for logger (xxx.yyy.DBConnection).
log4j:WARN Please initialize the log4j system properly.
After googling this message, I found this, where it says:
The reason why you see this message is that your log4j configuration file(i.e. log4j.xml or log4j.properties) is NOT found in the classpath.
But I have a log4j.properties in the same folder as my script and the jars I use. As you can see from the code snippet above, i tried to explicitly add the properties file to the classpath. I also tried to switch on log4j debugging via EXTRA_JAVA_ARGS, but nothing has helped me to get rid of the warnings.
I use perl 5.8.7 on SuSE Linux 10.0 and Inline::Java 0.52.
Any help would be greatly appreciated.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Using log4j via Inline::Java
by Anonymous Monk on May 18, 2009 at 07:16 UTC | |
by kreetrapper (Scribe) on May 18, 2009 at 07:41 UTC | |
|
Re: Using log4j via Inline::Java
by dHarry (Abbot) on May 18, 2009 at 07:56 UTC |