Usually the programmer used the System.out.print("Something") for debug. And tomcat, by default put it on Catalina.out.
Many System.out.print, made Catalina.out increase the size.
And One day all my report (using JNLP) can't show in. And the worst, all user can't login or made the transaction.
After I delete all logs, and restart again my tomcat, all report can be viewed again. Can login and made the transaction.
The Problem in here, The Catalina out is too big (almost 1 Giga the size ) cuase the system implemented since 2006.
The Solution is the catalina.out must be rotated.
I Used the apache tomcat 5.5.17, And for the rotation :
1. download catalina-5.5.23.jar, commons-digester-1.8.jar tomcat-util-5.5.23.jar
and then put it in common/classes on your tomcat folder.
2. Edit your server.xml, put the XML like this :
<Host name="localhost" appBase="webapps"
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
<Logger className="org.apache.catalina.logger.FileLogger"
directory="logs" prefix="localhost_log." suffix=".txt"
timestamp="true"/>
<DefaultContext reloadable="false" crossContext="true" swallowOutput="true"/>
<Context path="/app_run" docBase="app_run" crossContext="true" swallowOutput="true"></Context>
<Context path="/app_dev" docBase="app_dev" crossContext="true" swallowOutput="true"></Context>
<Context path="/app_demo" docBase="app_demo" crossContext="true" swallowOutput="true"></Context>
</Host>
And The logs folder become like this :
-rw-r--r-- 1 dev users 0 2008-12-18 18:46 admin.2008-12-18.log
-rw-r--r-- 1 dev users 0 2008-12-19 13:46 admin.2008-12-19.log
-rw-r--r-- 1 dev users 1912 2008-12-18 21:33 catalina.2008-12-18.log
-rw-r--r-- 1 dev users 1438 2008-12-19 13:46 catalina.2008-12-19.log
-rw-r--r-- 1 dev users 3350 2008-12-19 13:46 catalina.out
-rw-r--r-- 1 dev users 0 2008-12-18 18:46 host-manager.2008-12-18.log
-rw-r--r-- 1 dev users 0 2008-12-19 13:46 host-manager.2008-12-19.log
-rw-r--r-- 1 dev users 149134 2008-12-18 21:33 localhost.2008-12-18.log
-rw-r--r-- 1 dev users 12007 2008-12-19 13:48 localhost.2008-12-19.log
-rw-r--r-- 1 dev users 0 2008-12-18 18:46 manager.2008-12-18.log
-rw-r--r-- 1 dev users 0 2008-12-19 13:46 manager.2008-12-19.log
The Catalina.out will be updated only when tomcat start or stop.
And All logs like System.out.println will put on file localhost.yyyy-mm-dd.log, with yyyy-mm-dd is current date.
For More information for tomcat-logging you can visit http://wiki.apache.org/tomcat/FAQ/Logging#Q4
Friday, December 19, 2008
Subscribe to:
Post Comments (Atom)


0 comments:
Post a Comment