You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Amir Fadaghi <AF...@bcssi.sdps.org> on 2008/02/11 17:39:07 UTC

rotating catalina.out using log4j

Hi,

I am trying to implement the catalina.out log rotation in the development environment (for now and will implement to other environments once I figure this out) using log4j.  I am running apache-tomcat version 5.5.25 and downloaded the apache-log4j-1.2.15 and commons-logging-1.1.1.  I copied the log4j.jar and commons-logging.jar into the $CATALINA_HOME/lib and created the log4j.properties in the common/classes.  However, when I stop and start the apache-tomcat the cataline.out is not rotating.

 Here is the my directory listings in the commons/lib direcotry and commons/classes directory:

/usr/local/apache-tomcat-5.5.25/common:
ls lib
commons-el.jar             jasper-runtime.jar         naming-factory.jar
commons-logging-1.1.1.jar  jsp-api.jar                naming-resources.jar
jasper-compiler-jdt.jar    log4j-1.2.15.jar           servlet-api.jar
jasper-compiler.jar        naming-factory-dbcp.jar

should I change the highlighted filenames to commons-logging.jar and, log4j.jar?

/usr/local/apache-tomcat-5.5.25/common:
ls classes
log4j.properties

tail classes/log4j.properties

#
# Application logging options
#
#log4j.logger.org.apache=DEBUG
log4j.logger.org.apache=INFO
#log4j.logger.org.apache.struts=DEBUG
#log4j.logger.org.apache.struts=INFO

is the above line uncommented correct for rotating catalina.out rotation?

My environment is:
Sun Solaris 10

I thank you for any help you provide.



-----------------------------------------
Email messages cannot be guaranteed to be secure or error-free as
transmitted information can be intercepted, corrupted, lost,
destroyed, arrive late or incomplete, or contain viruses. The
Centers for Medicare & Medicaid Services therefore does not accept
liability for any error or omissions in the contents of this
message, which arise as a result of email transmission.

CONFIDENTIALITY NOTICE: This communication, including any
attachments, may contain confidential information and is intended
only for the individual or entity to which it is addressed. Any
review, dissemination, or copying of this communication by anyone
other than the intended recipient is strictly prohibited. If you
are not the intended recipient, please contact the sender by reply
email and delete and destroy all copies of the original message.

---------------------------------------------------------------------
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: rotating catalina.out using log4j

Posted by Amir Fadaghi <AF...@bcssi.sdps.org>.
David,
Thank you very much for your help with log4j 

>>> David Delbecq <de...@oma.be> 2/12/2008 2:53:40 AM >>>
catalina.out is just the sink for System.out and System.err, it's not 
managed by logging facilities. It's not even seen by jvm, as the 
redirection is done in the startup script (using the shell '>' 
redirector). If you configure a log4j logger for tomcat that uses an 
other file (see below our simple config) and teach all your webapps to

not use stdout and stderr, you shouldn't see anymore things appear in 
catalina.out. If you still need rolling of file during startup, you
will 
need to ask external tools (like unix logrotate) to do it for you.

......common/classes# cat log4j.properties
log4j.rootLogger=INFO, R
log4j.appender.R=org.apache.log4j.RollingFileAppender
log4j.appender.R.File=........./logs/tomcat.log
log4j.appender.R.MaxFileSize=30MB
log4j.appender.R.MaxBackupIndex=20
log4j.appender.R.layout=org.apache.log4j.PatternLayout
log4j.appender.R.layout.ConversionPattern=%p %t %c - %m%n


En l'instant précis du 11/02/08 17:39, Amir Fadaghi s'exprimait en ces

termes:
> Hi,
>
> I am trying to implement the catalina.out log rotation in the
development environment (for now and will implement to other
environments once I figure this out) using log4j.  I am running
apache-tomcat version 5.5.25 and downloaded the apache-log4j-1.2.15 and
commons-logging-1.1.1.  I copied the log4j.jar and commons-logging.jar
into the $CATALINA_HOME/lib and created the log4j.properties in the
common/classes.  However, when I stop and start the apache-tomcat the
cataline.out is not rotating.
>
>  Here is the my directory listings in the commons/lib direcotry and
commons/classes directory:
>
> /usr/local/apache-tomcat-5.5.25/common:
> ls lib
> commons-el.jar             jasper-runtime.jar        
naming-factory.jar
> commons-logging-1.1.1.jar  jsp-api.jar               
naming-resources.jar
> jasper-compiler-jdt.jar    log4j-1.2.15.jar          
servlet-api.jar
> jasper-compiler.jar        naming-factory-dbcp.jar
>
> should I change the highlighted filenames to commons-logging.jar and,
log4j.jar?
>
> /usr/local/apache-tomcat-5.5.25/common:
> ls classes
> log4j.properties
>
> tail classes/log4j.properties
>
> #
> # Application logging options
> #
> #log4j.logger.org.apache=DEBUG
> log4j.logger.org.apache=INFO
> #log4j.logger.org.apache.struts=DEBUG
> #log4j.logger.org.apache.struts=INFO
>
> is the above line uncommented correct for rotating catalina.out
rotation?
>
> My environment is:
> Sun Solaris 10
>
> I thank you for any help you provide.
>
>
>
> -----------------------------------------
> Email messages cannot be guaranteed to be secure or error-free as
> transmitted information can be intercepted, corrupted, lost,
> destroyed, arrive late or incomplete, or contain viruses. The
> Centers for Medicare & Medicaid Services therefore does not accept
> liability for any error or omissions in the contents of this
> message, which arise as a result of email transmission.
>
> CONFIDENTIALITY NOTICE: This communication, including any
> attachments, may contain confidential information and is intended
> only for the individual or entity to which it is addressed. Any
> review, dissemination, or copying of this communication by anyone
> other than the intended recipient is strictly prohibited. If you
> are not the intended recipient, please contact the sender by reply
> email and delete and destroy all copies of the original message.
>
>
---------------------------------------------------------------------
> 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 
>
>   


-- 
http://www.devlog.be (a belgian developer's logs)



---------------------------------------------------------------------
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 


---------------------------------------------------------------------
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: rotating catalina.out using log4j

Posted by David Delbecq <de...@oma.be>.
catalina.out is just the sink for System.out and System.err, it's not 
managed by logging facilities. It's not even seen by jvm, as the 
redirection is done in the startup script (using the shell '>' 
redirector). If you configure a log4j logger for tomcat that uses an 
other file (see below our simple config) and teach all your webapps to 
not use stdout and stderr, you shouldn't see anymore things appear in 
catalina.out. If you still need rolling of file during startup, you will 
need to ask external tools (like unix logrotate) to do it for you.

......common/classes# cat log4j.properties
log4j.rootLogger=INFO, R
log4j.appender.R=org.apache.log4j.RollingFileAppender
log4j.appender.R.File=........./logs/tomcat.log
log4j.appender.R.MaxFileSize=30MB
log4j.appender.R.MaxBackupIndex=20
log4j.appender.R.layout=org.apache.log4j.PatternLayout
log4j.appender.R.layout.ConversionPattern=%p %t %c - %m%n


En l'instant précis du 11/02/08 17:39, Amir Fadaghi s'exprimait en ces 
termes:
> Hi,
>
> I am trying to implement the catalina.out log rotation in the development environment (for now and will implement to other environments once I figure this out) using log4j.  I am running apache-tomcat version 5.5.25 and downloaded the apache-log4j-1.2.15 and commons-logging-1.1.1.  I copied the log4j.jar and commons-logging.jar into the $CATALINA_HOME/lib and created the log4j.properties in the common/classes.  However, when I stop and start the apache-tomcat the cataline.out is not rotating.
>
>  Here is the my directory listings in the commons/lib direcotry and commons/classes directory:
>
> /usr/local/apache-tomcat-5.5.25/common:
> ls lib
> commons-el.jar             jasper-runtime.jar         naming-factory.jar
> commons-logging-1.1.1.jar  jsp-api.jar                naming-resources.jar
> jasper-compiler-jdt.jar    log4j-1.2.15.jar           servlet-api.jar
> jasper-compiler.jar        naming-factory-dbcp.jar
>
> should I change the highlighted filenames to commons-logging.jar and, log4j.jar?
>
> /usr/local/apache-tomcat-5.5.25/common:
> ls classes
> log4j.properties
>
> tail classes/log4j.properties
>
> #
> # Application logging options
> #
> #log4j.logger.org.apache=DEBUG
> log4j.logger.org.apache=INFO
> #log4j.logger.org.apache.struts=DEBUG
> #log4j.logger.org.apache.struts=INFO
>
> is the above line uncommented correct for rotating catalina.out rotation?
>
> My environment is:
> Sun Solaris 10
>
> I thank you for any help you provide.
>
>
>
> -----------------------------------------
> Email messages cannot be guaranteed to be secure or error-free as
> transmitted information can be intercepted, corrupted, lost,
> destroyed, arrive late or incomplete, or contain viruses. The
> Centers for Medicare & Medicaid Services therefore does not accept
> liability for any error or omissions in the contents of this
> message, which arise as a result of email transmission.
>
> CONFIDENTIALITY NOTICE: This communication, including any
> attachments, may contain confidential information and is intended
> only for the individual or entity to which it is addressed. Any
> review, dissemination, or copying of this communication by anyone
> other than the intended recipient is strictly prohibited. If you
> are not the intended recipient, please contact the sender by reply
> email and delete and destroy all copies of the original message.
>
> ---------------------------------------------------------------------
> 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
>
>   


-- 
http://www.devlog.be (a belgian developer's logs)



---------------------------------------------------------------------
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