Tomcat / logging

Peter Schober peter.schober at univie.ac.at
Tue Jul 26 07:55:14 EDT 2016


* Cantor, Scott <cantor.2 at osu.edu> [2016-07-25 22:45]:
> Does anybody have a configuration for Tomcat 8 that uses logback for
> logging and has an access log, and would you be willing to sketch it
> out in the wiki as an example?
> Asking on behalf of TIER since we don't have a current example.

No, but what's wrong with http://logback.qos.ch/access.html ?
That it only mentions Tomcat7?

In order to get Tomcat to use logback for access logs I'm assuming I'd
needed to copy the logback and sl4j-api JARs to someplace Tomcat can
find them, then set Valve/@className in server.xml accordingly, plus
provide a logback-access.xml somewhere?

FWIW, so far I've only used the built-in logging (JULI) using the
org.apache.catalina.valves.AccessLogValve valve, the
org.apache.juli.FileHandler for access logs, and the
default java.util.logging.ConsoleHandler for catalina.out.

I seem to need the org.apache.juli.FileHandler enabled in Tomcat's
logging.properties in order to be able to log access logs from a Valve
defined in server.xml, but that also creates an (unwanted) file in
org.apache.juli.FileHandler.directory (by default called
juli.log). The only way I've found to get rid of that (i.e., to only
have catalina.out and access.log, the latter via server.xml) so far
was to trick Tomcat into writing that to /dev/null:
org.apache.juli.FileHandler.directory = /dev
org.apache.juli.FileHandler.prefix = null
org.apache.juli.FileHandler.suffix =
-peter


More information about the users mailing list