How to set up Cronolog in Tomcat for daily logging?
When I wanted to log the log daily, I edited the catalina.sh file in another to redirect the log to cronolog.
I think this is a bad solution because the catalina.sh file is a shell executable.
Can I customize it using edit properties or any files in the conf directory?
Is there another good solution?
new
org.apache.catalina.startup.Bootstrap " $ @ " start 2> & 1 \ | cronolog "$ CATALINA_BASE" / logs / catalina. % Y-% m-% d.out >> / dev / null &
old:
org.apache.catalina.startup.Bootstrap " $ @ " start \ >> "$ CATALINA_BASE" /logs/catalina.out 2> & 1 &
+2
source to share
2 answers
Why not use the correct logging framework instead of System.out? You have at least three at your disposal:
- java.util.logging and use RollingFileHandler from http://www.x4juli.org/
- Log4j and use DailyRollingFileAppender
- Logback and use RollingFileAppender
Using either of them, you will be able to control what you log (using levels - debug, info, warn, error) where you log (turn logs on and off) and write to different targets - files, db, mail, jms, etc. .d.
+2
source to share