Howdy,
While Mr. (?) Lenharcik's suggestion will work, I'd suggest doing it
slightly differently: use a ServletContextListener and initialize log4j
in the contextInitialized() method.  That will get called before any
servlet's init() method.  And the contextDestroyed() method of that
listener is a great place to shut down log4j gracefully
(LogManager.shutdown()).  The container is free to unload and reload any
servlet, including load-on-startup servlets, at any time, so init'ing
log4j in a servlet is not always optimal.

>- WEB-INF/webx.ml create an entry to init the servlet while server
start.
>One property of this entry is the path to your log4j config-file 

If you're using a servlet, it's <init-param>, if using a context
listener it's a context-param.

>(if your
>file is in /classes you can use reflection
>CLASSNAME.class.getRessource("/configfile.lcf")

Technically speaking, that's not reflection ;)  But it'll work.  For
people like me who don't like to mix config files and compiled code, you
can use the
ServletContext().getResource("/pathtoyourconfigfilefromyourcontextroot")
call to do the same.

Yoav Shapira
Millennium ChemInformatics

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to