Logging
- Logging should not be set to DEBUG in Production unless necessary to solve a specific problem.
- Logging should be directed to a log file specific to the application. This log file should have a name that starts with the name of the application, e.g. if your application is called dml, the log file should be dml.log or dml-something.log.
- Log statements that go to System.out and end up in catalina.out should be avoided.
- Logging Exceptions
- When using log4j, ensure that stack traces are included in logged exceptions by using the Logger.error(Object message, Throwable t) method.
- Don't log exceptions that are caught and handled properly
Questions
The DailyRollingFileAppender is nice because you can easily find historical information in logs, but could we set up a cron job to zip up and archive all old log files?
Should we use log files for stastistics generation, or implement another method?