You are on page 1of 1

Logging Issue

**TDM Web Application**


By default Grails framework logs to stdout and file appender.
log4j = {
appenders {
rollingFile name: 'perfstat', maxFileSize: '50MB', maxBackupIndex: 10, f
ile: "${System.env.TDM_HOME}/logs/tdm_stat.log"
rollingFile name: 'appLog', maxFileSize: '50MB', maxBackupIndex: 10, fil
e: "${System.env.TDM_HOME}/logs/tdm_app.log"
rollingFile name: 'auditLog', maxFileSize: '50MB', maxBackupIndex: 10, f
ile: "${System.env.TDM_HOME}/logs/tdm_audit.log", layout: pattern(conversionPatt
ern: '%m%n')
}
root {
error 'stdout', 'appLog'
}
}
Thus anything logged will also be shown in Console (IntelliJ or Command Prompt o
r Tomcat Log)
To change this behavior in QA or prod environment, we need to modify the above c
onfiguration
log4j = {
root {
error 'appLog'
}
}
After making this change, tomcat std-out logs will no more show the tdm-web-appl
ication logs. But it may contains System.out and System.err statements.
appLog appender will log statements into file configured as per configuratoin (T
DM_HOME/logs/)
**Tomcat Logging**
There are two ways to log in tomcat
1. lib/log4j.conf which supports rollingFileAppender. This configuration is for
Tomcat's internal logging only, it will not log any web-app related statements.
2. redirects from stdout and stderr (using Tomcat Configurer), this is simply ap
pending the logs to the mentioned file and it does not care about the rolling fi
le, fileSize etc. This can log for Tomcat as well as Webapps (STDOUT and STDERR
statements)