Tomcat / logging
Peter Schober
peter.schober at univie.ac.at
Tue Jul 26 10:43:11 EDT 2016
* Cantor, Scott <cantor.2 at osu.edu> [2016-07-26 15:36]:
> > No, but what's wrong with http://logback.qos.ch/access.html ?
> > That it only mentions Tomcat7?
>
> Nothing wrong with it, just asking somebody with an actual working
> configuration to add it to the wiki.
Using only the examples from http://logback.qos.ch/access.html worked
fine for me. On Debian 8 (with Tomcat 8.0.x) that is all I did, for
reference or discussion. I can put something in the wiki once we're
sure that's sane:
* Symlinked the required JARs to $CATALINA_HOME/lib/ they were part of
the unpackaged IDP distro and/or ${idp.home}/webapp/WEB-INF/lib/
(Not sure where else I'd find authentic copies of the required JARs.)
cd /usr/share/tomcat8/lib
ln -s /usr/local/src/shibboleth-identity-provider-3.2.1/embedded/jetty-base/lib/logging/logback-access-1.1.3.jar
ln -s /opt/shibboleth-idp/webapp/WEB-INF/lib/slf4j-api-1.7.12.jar
ln -s /opt/shibboleth-idp/webapp/WEB-INF/lib/logback-*
* Replaced the Valve element in Tomcat's server.xml w/ example from section
LogBackValve: <Valve className="ch.qos.logback.access.tomcat.LogbackValve"/>
E.g. a minimal working config could look like this:
<Engine name="Catalina" defaultHost="localhost">
<Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true" />
<Valve className="ch.qos.logback.access.tomcat.LogbackValve" quiet="true" />
</Engine>
* Added the "Example 2: RollingFileAppender" as logback-access.xml to
$CATALINA_BASE/conf/ (/etc/tomcat8 for me), *only* adjusting the
content of the <file> element with a full path (possibliy defaults to
$CATALINA_BASE/conf/ which is not writable for the Tomcat/JVM user
in my deployment).
Personally I've also changed s/zip/gz/ in fileNamePattern.
* Restarted Tomcat
* To catch STDOUT/STDERR in catalina.out I think the existing
logging.properties and JUL logging is still relevant. A minimal
working one could look like this:
handlers = java.util.logging.ConsoleHandler
.handlers = java.util.logging.ConsoleHandler
java.util.logging.ConsoleHandler.level = INFO
java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
But I'm not at all a Tomcat or Java person, so YMMV.
-peter
More information about the users
mailing list