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.


In reply to Using log4j via Inline::Java by kreetrapper

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.