J
John
I am trying to have two logs for my app, 1 for auditing and the other
for everything else. I defined to loggers in log4j.properties (see
contents below).
The problem I am having is that all messages are going to both
loggers.
Any suggestions?
============ log4j.properties ============
log4j.rootLogger=error, stdout, audit
log4j.appender.stdout=org.apache.log4j.RollingFileAppender
log4j.appender.stdout.File=/home/nacash/sites-i/regreporting/cotterjo/logs/example.log
log4j.appender.stdout.MaxFileSize=7000KB
# Keep one backup file
log4j.appender.stdout.MaxBackupIndex=6
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%p %d %m%n
log4j.appender.audit.Threshold=fatal
log4j.appender.audit=org.apache.log4j.RollingFileAppender
log4j.appender.audit.File=/home/nacash/sites-i/regreporting/cotterjo/logs/audit.log
log4j.appender.audit.MaxFileSize=7000KB
# Keep one backup file
log4j.appender.audit.MaxBackupIndex=6
log4j.appender.audit.layout=org.apache.log4j.PatternLayout
log4j.appender.audit.layout.ConversionPattern=%p %d - %m%n
============ Java Code Segment ============
public abstract class RegRptAbstractAction extends Action {
//static Logger logger =
Logger.getLogger(RegRptAbstractAction.class);
static Logger logger = Logger.getLogger("stdout");
static Logger auditLogger = Logger.getLogger("audit");
public ActionForward execute(...)
throws Exception {
String employeeName="unknown";
auditLogger.fatal("User: " + employeeName + " Request: " +
request.getRequestURI());
logger.error(" Testing error message ");
for everything else. I defined to loggers in log4j.properties (see
contents below).
The problem I am having is that all messages are going to both
loggers.
Any suggestions?
============ log4j.properties ============
log4j.rootLogger=error, stdout, audit
log4j.appender.stdout=org.apache.log4j.RollingFileAppender
log4j.appender.stdout.File=/home/nacash/sites-i/regreporting/cotterjo/logs/example.log
log4j.appender.stdout.MaxFileSize=7000KB
# Keep one backup file
log4j.appender.stdout.MaxBackupIndex=6
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%p %d %m%n
log4j.appender.audit.Threshold=fatal
log4j.appender.audit=org.apache.log4j.RollingFileAppender
log4j.appender.audit.File=/home/nacash/sites-i/regreporting/cotterjo/logs/audit.log
log4j.appender.audit.MaxFileSize=7000KB
# Keep one backup file
log4j.appender.audit.MaxBackupIndex=6
log4j.appender.audit.layout=org.apache.log4j.PatternLayout
log4j.appender.audit.layout.ConversionPattern=%p %d - %m%n
============ Java Code Segment ============
public abstract class RegRptAbstractAction extends Action {
//static Logger logger =
Logger.getLogger(RegRptAbstractAction.class);
static Logger logger = Logger.getLogger("stdout");
static Logger auditLogger = Logger.getLogger("audit");
public ActionForward execute(...)
throws Exception {
String employeeName="unknown";
auditLogger.fatal("User: " + employeeName + " Request: " +
request.getRequestURI());
logger.error(" Testing error message ");