Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Tomcat Wiki" for change 
notification.

The "FAQ/Logging" page has been changed by ChristopherSchultz:
http://wiki.apache.org/tomcat/FAQ/Logging?action=diff&rev1=19&rev2=20

Comment:
Expanded the section on rotating catalina.out

   1. [[#Q3|What role does JULI and log4j play in logging?]]
   1. [[#Q4|How do I configure commons-logging for use with Tomcat?]]
   1. [[#Q5|How should I log in my own webapps?]]
-  1. [[#Q6|Where does System.out go? How do I rotate catalina.out?]]
+  1. [[#Q6|Where does System.out go?]]
+  1. [[#Q10|How do I rotate catalina.out]]?
   1. [[#Q7|Where are the logs when running Tomcat as a Windows service?]]
   1. [[#Q8|How do I customize the location of the tomcat logging.properties 
file?]]
   1. [[#Q9|Since java.logging is the default commons-logging implementation in 
Tomcat, why is it not working in my Linux distribution?]]
@@ -77, +78 @@

  
  We also recommend that you separate your logging from Tomcat's internal 
logging. That means you should bundle your logging toolkit with your webapp. If 
you are using Log4J, for example, place the Log4J jar in the WEB-INF/lib 
directory of your webapp and the Log4J configuration file in the 
WEB-INF/classes directory of your webapp. This way different web applications 
can have different logging configurations and you don't need to worry about 
them interfering with each other.
  
- <<Anchor(Q6)>>'''Where does System.out go? How do I rotate catalina.out?'''
+ <<Anchor(Q6)>>'''Where does System.out go?'''
  
- System.out and System.err both print to catalina.out. But you can suppress 
this via the swallowOutput property and sent to different log files. 
catalina.out does not rotate. But it should not be an issue because nothing 
should be printing to standard output since you are using a logging package, 
right? [[http://marc.info/?t=105544472600001&r=1&w=2a|thread about rotation of 
catalina.out]]
+ System.out and System.err are both redirected to 
CATALINA_BASE/logs/catalina.out when using Tomcat's startup scripts 
(bin/startup.sh/.bat or bin/catalina.sh/.bat). Any code that writes to 
System.out or System.err will end up writing to that file.
+ 
+ If your webapp uses System.out and/or System.err a lot, you can suppress this 
via the 'swallowOutput' attribute in your <Context> configuration element and 
send to different log files (configured elsewhere: see the documentation for 
configuring logging).
+ 
+ <<Anchor(Q10)>>'''How do I rotate catalina.out?'''
+ 
+ CATALINA_BASE/logs/catalina.out does not rotate. But it should not be an 
issue because nothing should be printing to standard output since you are using 
a logging package, right?
+ 
+ If you really must rotate catalina.out, here are some techniques you can use:
+ 
+  1. If you are using jsvc 1.0.4 or later to launch Tomcat, you can send 
SIGUSR1 to jsvc to get it to re-open its log files 
([[https://issues.apache.org/jira/browse/DAEMON-95|Jira Ticket]]). You can 
couple this with 'logrotate' or your favorite log-rotation utility (including 
good-old 'mv' or 'rename') to re-name catalina.out at intervals and then get 
jsvc to re-open the original (catalina.out) file and continue writing to it. 
Note that Tomcat's win32 service is the same thing as jsvc, but you may have 
difficulty sending SIGUSR1 in a win32 environment.
+  1. Use 'logrotate' with the 'copytruncate' option. This allows you to 
externally rotate catalina.out without changing anything within Tomcat.
+  1. Modify bin/catalina.sh/.bat to pipe output from the JVM into a 
piped-logger such as [[http://www.cronolog.org/|chronolog]] or Apache httpd's 
[[http://httpd.apache.org/docs/2.2/logs.html#piped|rotatelogs]] (note that the 
previous reference is for Apache httpd documentation and *is not applicable to 
Tomcat* -- it merely illustrates the concept).
+ 
+ References to mailing list discussions:
+  * [[http://marc.info/?t=105544472600001&r=1&w=2a|tomcat-user thread from 
2003]]
+  * [[http://markmail.org/thread/2t6y5lf4dnx4nqpb|tomcat-user thread from 
2009]]
+  * [[http://markmail.org/thread/oif7l27h4nqp3g4e|tomcat-user thread from 
2011]]
+  * [[http://markmail.org/thread/3cjpvgjkpxrqrhlp|tomct-user thread from 2012]]
  
  <<Anchor(Q7)>>'''Where are the logs when running Tomcat as a Windows 
service?'''
  

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to