Hello,

Have you already thought about loading per default not the first best
"log4j.xml" file? I have several modules like a "core" module. These modules
are available as jar files. In each jar file there is a "log4j.xml" file.
Now I write my application which has a dependency to the "core" module. If I
have no "log4.xml" file in my application, log4j will be configured by using
core's "log4j.xml". Now I'd like to have my own "log4j.xml" file for my
application, and I don't want to change the "core" module. Naturally the
"core" module will be loaded before my application I've got the problem,
that the "log4j.xml" has no chance to be loaded by log4j, because the Loader
inside uses following:

    URL url = classLoader.getResource("log4j.xml");

I suggest to use following:

    URL url = null;
    Enumeration urls = classLoader.getResources("log4j.xml");
    while (urls.hasMoreElements()) {
        url = (URL) urls.nextElement();
    }

By this way I get always the last "log4j.xml" in classpath, in my example
"log4j.xml" from my application.

What's your opinion?

Cheers,
Martin Zeltner

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to