In log4j 1.3, log4j will first search for log4j.xml and second for log4j.properties unless the log4j.configuration system property was specified by the user.
Does that answer your request? At 12:14 01.04.2002 -0700, Ray Thomas wrote: >I know log4j finds log4j.properties automatically if it is placed in the >classpath. Is there any "default" xml config file or does xml based >configuration always require -Dlog4j.configuration=whatever.xml >to be specified when the JVM starts? (Command line length is already an >issue with other such -D options). > >If this feature is not in log4j yet, the following code would find >log4j.xml in the context classloader's classpath (the same way >ResourceBundle does). However, loading this way might not give the XML >parser enough info to find the dtd by relative reference. i.e. The dtd >might need to be hosted locally on a webserver and referenced as >http://localhost/dtds/log4j.dtd or possibly copied to the user.home >directory for the jvm. > > ClassLoader classLoader = getClass().getClassLoader(); > InputStream configInputStream = >classLoader.getResourceAsStream("log4j.xml"); > InputStreamReader configReader = new >InputStreamReader(configInputStream); > configDOMDocument = myXmlParser.parse(new InputSource(configReader)); > >-R -- Ceki My link of the month: http://www.suntimes.com/output/otherviews/cst-edt-ref31.html -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>