You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Ray Thomas <rt...@liveintellect.org> on 2002/04/01 21:14:02 UTC
Default XML file?
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
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Default XML file?
Posted by Ray Thomas <rt...@liveintellect.org>.
Yes. This answers my question.
Given that 1.2 is still beta, I guess this means it'll be a while before
this is released in 1.3.
Oh well... :(
-R
----- Original Message -----
From: "Ceki Gülcü" <ce...@qos.ch>
To: "Log4J Users List" <lo...@jakarta.apache.org>
Sent: Monday, April 01, 2002 2:33 PM
Subject: Re: Default XML file?
>
> 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:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>
>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Default XML file?
Posted by Ceki Gülcü <ce...@qos.ch>.
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: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>