Maybe there exists indeed a file "C:\Programme\Mozilla 
Firefox\de\xyz\...\log4j.xml" which is found first by the classloader? Then try 
getResources() to get an enumeration of all resources found.
Or try getSystemResource() of the classloader.
Heri

-----Ursprüngliche Nachricht-----
Von: Linnemann, Gerrit [mailto:linnem...@hesgdv.de] 
Gesendet: Dienstag, 10. Februar 2009 07:31
An: log4j-user@logging.apache.org
Betreff: Load a log4j.xml located within a package - how?

Hallo,
I'm trying to load a separate config file (log4j.xml) within a jar-File. It is 
an applet and I want to load a config file located within a package.
I tried it like this:
        URL path2Conf = 
this.getClass().getClassLoader().getResource("de/xyz/log4j/applets/log4j.xml");
        DOMConfigurator.configure(path2Conf);

But the java console of the browser says, the DOMConfigurator wants to load the 
XML from
        C:\Programme\Mozilla Firefox\de\xyz\...\log4j.xml


The same with:
        String path2Conf = System.getProperty("user.dir") + File.separator + 
"de\\hes\\log4j\\applets\\log4j.xml";
        DOMConfigurator.configure(path2Conf);


Has anyone an Idea how to load a config file located within a package?


Thanking you in anticipation,
Gerrit


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-user-h...@logging.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-user-h...@logging.apache.org

Reply via email to