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 Tuan Jean Tee <tu...@minterellison.com> on 2003/11/05 01:29:14 UTC

How do I do to change the properties file for log4j into another directory?

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.


IMPORTANT -

This email and any attachments are confidential and may be privileged in which case neither is intended to be waived. If you have received this message in error, please notify us and remove it from your system. It is your responsibility to check any attachments for viruses and defects before opening or sending them on. Where applicable, liability is limited by the Solicitors Scheme approved under the Professional Standards Act 1994 (NSW). Minter Ellison collects personal information to provide and market our services. For more information about use, disclosure and access, see our privacy policy at www.minterellison.com.


Re: How do I do to change the properties file for log4j intoanother directory?

Posted by Rishikesh Tembe <ri...@eml.cc>.
use PropertyConfigurator.configure()

-Rishi

On Wed, 05 Nov 2003 11:29:14 +1100, "Tuan Jean Tee"
<tu...@minterellison.com> said:
> 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.
> 
> 
> IMPORTANT -
> 
> This email and any attachments are confidential and may be privileged in
> which case neither is intended to be waived. If you have received this
> message in error, please notify us and remove it from your system. It is
> your responsibility to check any attachments for viruses and defects
> before opening or sending them on. Where applicable, liability is limited
> by the Solicitors Scheme approved under the Professional Standards Act
> 1994 (NSW). Minter Ellison collects personal information to provide and
> market our services. For more information about use, disclosure and
> access, see our privacy policy at www.minterellison.com.
> 
ciao,
Rishi
-----
"Let's think the unthinkable, let's do the undoable, let's prepare to
grapple with the ineffable itself... And see if we may not eff it after
all."

-- 
http://www.fastmail.fm - Send your email first class

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: log4j-user-help@jakarta.apache.org


Re: How do I do to change the properties file for log4j into another directory?

Posted by Jacob Kjome <ho...@visi.com>.
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