logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Malik, Pratibha" <Pratibha.Ma...@safenet-inc.com>
Subject RE: A question about log4j and the location of "log4j.properties" in a web application
Date Mon, 28 Jan 2008 05:23:55 GMT
You can add a configuration dir in ur MyWeb folder and add the
log4j.properties in that folder.

-----Original Message-----
From: Jacob Kjome [mailto:hoju@visi.com] 
Sent: Monday, January 28, 2008 4:09 AM
To: Log4J Users List
Subject: Re: A question about log4j and the location of
"log4j.properties" in a web application



Thomas Chang wrote:
> Hi all,
>  
>   I use maven2 to build a webapp. I want to use the log4j. The
dir-structure looks as follow:
>    
>   MyWeb/
>     /src
>        /main
>           /java
>           /res
>        /webapp
>           /WEB-INF
>    
>   Now I have two questons:
>   
> 1.
> Where should I put the "log4j.properties"? I think it should be under
/webapp//WEB-INF?
>  

/webapp/WEB-INF/ is not in the classapth.  Therefore, Log4j will not
find it via 
auto-configuration.  You will have to perform manual configuration to
load this.

> 2.
> How can the program find this file (I mean how to write in the java)?
>  

Use the Servlet API.
servletContext.getResourceAsStream("/WEB-INF/log4j.properties");


Jake

> Regards
>  
> Thomas
> 
> 
>        
> ---------------------------------
> Ihr erstes Baby? Holen Sie sich Tipps von anderen Eltern.

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

The information contained in this electronic mail transmission 
may be privileged and confidential, and therefore, protected 
from disclosure. If you have received this communication in 
error, please notify us immediately by replying to this 
message and deleting it from your computer without copying 
or disclosing it.



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


Mime
View raw message