You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Lisa <ap...@purpleblade.net> on 2007/01/16 01:49:51 UTC

How to enable log4 for use with Tomcat?

I have tomcat 5.5.16 and have just downloaded log4j-1.2.14.jar and put it in
common/lib.  

Now how do I tell Tomcat to use this jar and to specifiy a log4j.xml file to
use for the configuration?

I see conf/logging.properties but I want to use log4j.xml instead of a
.properties file.

Thanks


Lisa
-- 
View this message in context: http://www.nabble.com/How-to-enable-log4-for-use-with-Tomcat--tf3018241.html#a8382422
Sent from the Tomcat - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: How to enable log4 for use with Tomcat?

Posted by Lisa <ap...@purpleblade.net>.
Specifying the location of the log4j.xml file in CATALINA_OPTS is ignored. 
It will only pick it up from the classes/ directory.  Ideally I would like
to put it under the conf/ directory but am having no such luck.

I got it to work sort of.  I can not get fileappenders to work.  I am trying
to log all INFO from com.apache.myfaces to $CATALINA_HOME/logs/jsf.info.log
but am having no luck.

any ideas would be appreciated.




Caldarale, Charles R wrote:
> 
>> From: Lisa [mailto:apache_support@purpleblade.net] 
>> Subject: RE: How to enable log4 for use with Tomcat?
>> 
>> yes, but there is no mention about log4j.xml.  What config 
>> file in tomcat do I edit to point to a log4j.xml file and
>> have it use that for config instead of the .properties file.
> 
> Look at the Default Initialization Procedure and Example Configurations
> sections here:
> http://logging.apache.org/log4j/docs/manual.html
> (about 3/4 of the way down).
> 
> If you don't want to use the .properties format, remove (or rename) the
> tomcat-juli.jar from Tomcat's bin directory, then specify the location
> of the .xml file in CATALINA_OPTS or JAVA_OPTS (or as a -D parameter if
> running as a Windows service) per the above doc.  However, note this
> comment in the Tomcat docs for log4j:
> 
> "Note that there are known issues with using this naming convention
> (with square brackets) in log4j XML based configuration files, so we
> recommend you use a properties file as described until a future version
> of log4j allows this convention."
> 
>  - Chuck
> 
> 
> THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
> MATERIAL and is thus for use only by the intended recipient. If you
> received this in error, please contact the sender and delete the e-mail
> and its attachments from all computers.
> 
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/How-to-enable-log4-for-use-with-Tomcat--tf3018241.html#a8402032
Sent from the Tomcat - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: How to enable log4 for use with Tomcat?

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Lisa [mailto:apache_support@purpleblade.net] 
> Subject: RE: How to enable log4 for use with Tomcat?
> 
> yes, but there is no mention about log4j.xml.  What config 
> file in tomcat do I edit to point to a log4j.xml file and
> have it use that for config instead of the .properties file.

Look at the Default Initialization Procedure and Example Configurations
sections here:
http://logging.apache.org/log4j/docs/manual.html
(about 3/4 of the way down).

If you don't want to use the .properties format, remove (or rename) the
tomcat-juli.jar from Tomcat's bin directory, then specify the location
of the .xml file in CATALINA_OPTS or JAVA_OPTS (or as a -D parameter if
running as a Windows service) per the above doc.  However, note this
comment in the Tomcat docs for log4j:

"Note that there are known issues with using this naming convention
(with square brackets) in log4j XML based configuration files, so we
recommend you use a properties file as described until a future version
of log4j allows this convention."

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you
received this in error, please contact the sender and delete the e-mail
and its attachments from all computers.

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: How to enable log4 for use with Tomcat?

Posted by Lisa <ap...@purpleblade.net>.
yes, but there is no mention about log4j.xml.  What config file in tomcat do
I edit to point to a log4j.xml file and have it use that for config instead
of the .properties file.

thanks

Lisa


Caldarale, Charles R wrote:
> 
>> From: Lisa [mailto:apache_support@purpleblade.net] 
>> Subject: How to enable log4 for use with Tomcat?
>> 
>> Now how do I tell Tomcat to use this jar and to specifiy a 
>> log4j.xml file to use for the configuration?
> 
> Have you looked at the relevant doc?
> http://tomcat.apache.org/tomcat-5.5-doc/logging.html#log4j
> 
>  - Chuck
> 
> 
> THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
> MATERIAL and is thus for use only by the intended recipient. If you
> received this in error, please contact the sender and delete the e-mail
> and its attachments from all computers.
> 
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/How-to-enable-log4-for-use-with-Tomcat--tf3018241.html#a8384901
Sent from the Tomcat - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: How to enable log4 for use with Tomcat?

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Lisa [mailto:apache_support@purpleblade.net] 
> Subject: How to enable log4 for use with Tomcat?
> 
> Now how do I tell Tomcat to use this jar and to specifiy a 
> log4j.xml file to use for the configuration?

Have you looked at the relevant doc?
http://tomcat.apache.org/tomcat-5.5-doc/logging.html#log4j

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you
received this in error, please contact the sender and delete the e-mail
and its attachments from all computers.

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org