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 Thomas Chang <th...@yahoo.de> on 2008/01/26 16:07:20 UTC
A question about log4j and the location of "log4j.properties" in a web application
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?
2.
How can the program find this file (I mean how to write in the java)?
Regards
Thomas
---------------------------------
Ihr erstes Baby? Holen Sie sich Tipps von anderen Eltern.
Re: A question about log4j and the location of "log4j.properties" in a web application
Posted by Thomas Chang <th...@yahoo.de>.
Hi Jake,
I use JSF, the servlet is embayded.
> 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");
*********************
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.
Jake
---------------------------------
Ihr erstes Fernweh? Wo gibt es den schönsten Strand.
RE: A question about log4j and the location of "log4j.properties" in a web application
Posted by "Malik, Pratibha" <Pr...@safenet-inc.com>.
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
Re: A question about log4j and the location of "log4j.properties"
in a web application
Posted by Jacob Kjome <ho...@visi.com>.
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