logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark F <mfa...@knology.net>
Subject Tomcat -- All Logs to Syslog
Date Thu, 02 Feb 2006 16:04:05 GMT
Version: 5.0.30
Log4j:   1.3


I'm attempting to use log4j for all of tomcat logs.  I would like for 
all logging to be output to the syslog daemon running on localhost.

I've configured a log4j.properties file and placed it in 
$CATALINA_HOME/common/classes:

log4j.rootLogger=INFO, A1
log4j.appender.A1=org.apache.log4j.net.SyslogAppender
log4j.appender.A1.SyslogHost=127.0.0.1
log4j.appender.A1.facility=LOCAL7
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
log4j.appender.A1.layout.ConversionPattern=%-4r %-5p %c{2} %M.%L %x - %m\n

I've configured the server to start with jsvc as the user "tomcat".

/etc/init.d/tomcat:
...
JAVA_HOME=$JAVA_HOME
CATALINA_HOME=/usr/share/tomcat
DM_HOME=/opt/documentum
DFC_CONFIG=$DM_HOME/shared/config/
DFC_HOME=$DM_HOME/shared/dfc
DAEMON_HOME=$CATALINA_HOME/bin
TOMCAT_USER=tomcat
TOMCAT_LOG_DIR=/var/log/tomcat
LOG4J_CONFIG=log4j.properties
TMP_DIR=$CATALINA_HOME/temp
...
start() {
     #
     # Start Tomcat
     #
     chown -R $TOMCAT_USER:$TOMCAT_USER /usr/share/tomcat/*
     $DAEMON_HOME/jsvc \
     -user $TOMCAT_USER \
     -home $JAVA_HOME \
     -Dlog4j.debug \
     -Dcatalina.home=$CATALINA_HOME \
     -Djava.io.tmpdir=$TMP_DIR \
     -Dlog4j.configuration=$LOG4J_CONFIG \
 
-Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JLogger 
\
     $CATALINA_OPTS \
     -cp $CLASSPATH org.apache.catalina.startup.Bootstrap
     RETVAL=$?
     echo
     [ $RETVAL = 0 ] && touch /var/lock/subsys/tomcat
     PID=`cat /var/run/jsvc.pid`
     echo "Starting Tomcat 5 with PID: $PID"
     return $RETVAL
}
...

The server starts just fine and everything works except for the log file 
isn't created or written.


I've tried configuring /etc/syslog-ng/syslog-ng.conf several different 
ways but none have worked.  I read somewhere that syslogappender sends 
logs via udp so I even tried configuring a seperate source just for tomcat:

source tomcat {
         internal();
         udp(ip("127.0.0.1") port(514));
};

and then logging to that source.

# Tomcat system logs
destination tomcat { file("/var/log/tomcat/tomcat-log" owner(tomcat) 
group(logs) perm(0640) ); };
log { source(tomcat);  destination(tomcat); };


This didn't work.

I'm at the end of my rope here, any suggestions/help will be greatly 
appreciated.

Thanks,
-Mark




---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Mime
View raw message