You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Softwareentwicklung Hauschel <So...@Hauschel.de> on 2003/01/22 12:42:08 UTC
loading configuration on startup
Hey all,
were did i load my own configuration on startup ?
for example the log4j configuration.
I tried to extend the actionservlet and wrap the init method's, but i didn't
receive the init Parameters from web.xml ;-(
Servlet for beginners ?!??
thanks Fredy
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: AW: loading configuration on startup
Posted by Dom <do...@free.fr>.
Hi
Log4j 1.2.7 can load log4.xml from your classpath
Or you can use jakarta commons-logging, which will load your log4j.xml
automaticaly too
Dom
----- Original Message -----
From: "Gemes Tibor" <ti...@i-trade.hu>
To: "Struts Users Mailing List" <st...@jakarta.apache.org>
Sent: Wednesday, January 22, 2003 1:13 PM
Subject: Re: AW: loading configuration on startup
2003. január 22. 12:59 dátummal Softwareentwicklung Hauschel ezt írtad:
> But my log4j.properties are a log4j.xml file.
> That doesn't work in classpath ;-(
> In addition there are mor configurations i need for the whole applikation.
I can't see why can you not pick up the init-params in your serlvet's init()
method. It's so easy.
For each servlet I wrote I provide the config parameter which is an xml
file.
This xml is parsed with Digester.
This is how I do it, and do not be surprised if you see some coincidence
with
the ActionServlet's init() method...
public void init() throws ServletException {
String value;
try {
LOG.debug("start init");
// Initialize the context-relative path to our configuration
resources
value = getServletConfig().getInitParameter("config");
if (value != null)
config = value;
// Acquire an input stream to our configuration resource
InputStream input =
getServletContext().getResourceAsStream(config);
if (input == null)
throw new UnavailableException
("config file '" + config + "' is missing");
Digester digester = null;
digester = initDigester();
...
Hth,
Tib
--
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: AW: loading configuration on startup
Posted by Gemes Tibor <ti...@i-trade.hu>.
2003. január 22. 12:59 dátummal Softwareentwicklung Hauschel ezt írtad:
> But my log4j.properties are a log4j.xml file.
> That doesn't work in classpath ;-(
> In addition there are mor configurations i need for the whole applikation.
I can't see why can you not pick up the init-params in your serlvet's init()
method. It's so easy.
For each servlet I wrote I provide the config parameter which is an xml file.
This xml is parsed with Digester.
This is how I do it, and do not be surprised if you see some coincidence with
the ActionServlet's init() method...
public void init() throws ServletException {
String value;
try {
LOG.debug("start init");
// Initialize the context-relative path to our configuration
resources
value = getServletConfig().getInitParameter("config");
if (value != null)
config = value;
// Acquire an input stream to our configuration resource
InputStream input =
getServletContext().getResourceAsStream(config);
if (input == null)
throw new UnavailableException
("config file '" + config + "' is missing");
Digester digester = null;
digester = initDigester();
...
Hth,
Tib
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
AW: loading configuration on startup
Posted by Softwareentwicklung Hauschel <So...@Hauschel.de>.
But my log4j.properties are a log4j.xml file.
That doesn't work in classpath ;-(
In addition there are mor configurations i need for the whole applikation.
thanks and best regards
Fredy
-----Ursprüngliche Nachricht-----
Von: Gemes Tibor [mailto:tib@i-trade.hu]
Gesendet: Mittwoch, 22. Januar 2003 12:51
An: Struts Users Mailing List
Betreff: Re: loading configuration on startup
2003. január 22. 12:42 dátummal Softwareentwicklung Hauschel ezt írtad:
> Hey all,
> were did i load my own configuration on startup ?
>
> for example the log4j configuration.
It is loaded automagically supposing that the log4j.properties resides on
your
CLASSPATH.
Tib
--
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: loading configuration on startup
Posted by Gemes Tibor <ti...@i-trade.hu>.
2003. január 22. 12:42 dátummal Softwareentwicklung Hauschel ezt írtad:
> Hey all,
> were did i load my own configuration on startup ?
>
> for example the log4j configuration.
It is loaded automagically supposing that the log4j.properties resides on your
CLASSPATH.
Tib
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>