java - How to get a .jar to recognise and use a bundled log4j.xml file? -


i'm building project ant , during build i'd bundle log4j.xml file directly .jar make distribution simpler. i've been successful in adding file .jar, doesn't seem recognised.

what need ensure file recognised , used log4j? i'm new java, clear description, examples if possible, great!

this somehow works.

static // loads before else can {    /*     * if log4j.configuration system property isn't set,     * assume i'm inside jar , configure     * log4j using config file shipped in jar.     */    if (system.getproperty("log4j.configuration") == null)    {       url url = classloader.getsystemresource("log4j.xml");       domconfigurator.configure(url);    } } 

Comments

Popular posts from this blog

windows - Why does Vista not allow creation of shortcuts to "Programs" on a NonAdmin account? Not supposed to install apps from NonAdmin account? -

c++ - How do I get a multi line tooltip in MFC -

unit testing - How to mock PreferenceManager in Android? -