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

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

asp.net - In javascript how to find the height and width -

c# - DataTable to EnumerableRowCollection -