logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jacob Kjome <h...@visi.com>
Subject Re: How do I do to change the properties file for log4j into another directory?
Date Thu, 06 Nov 2003 05:33:59 GMT
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


Mime
View raw message