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 Jacob Kjome <ho...@visi.com> on 2003/11/06 06:33:59 UTC
Re: How do I do to change the properties file for log4j into
another directory?
At 11:29 AM 11/5/2003 +1100, you wrote:
>I am using the Log Tag Library 1.0 from Jakarta Project.
>
>In the Installation document, it suggest that in order to initialize
>Log4j automatically, the log4j.properties file will have to be placed in
>/WEB-INF/classes.
>
>How could I put the log4j.properties file in /WEB-INF/classes/config
>directory? What do I have to do?
>
>Thank you.
If you are going to create a "config" dir, why not do it directly under
WEB-INF rather than where classes are put? You can load up an input stream
using context.getResourceAsStream("WEB-INF/config/log4j.properties") and
feed that info a Properties object, then send that into
PropertyConfigurator.configure(Properties) or load up a URL using
context.getResource("WEB-INF/config/log4j.properties") and send that info
PropertyConfigurator.configure(URL).
Of course you can still do this even if you leave the "config" directory
under "WEB-INF/classes" and use the same technique above. Whatever you
feel comfortable with. I just like not cluttering my classpath with
non-classes.
Jake
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: log4j-user-help@jakarta.apache.org