tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brian Burch <>
Subject Puzzled by Access Valve Logging
Date Fri, 12 Jul 2013 13:51:53 GMT
While working on, I was 
surprised to discover my log files generated by AccessLogValve do not 
seem to be handled by log4j.

I've worked with the various Authenticator Valves and all I could 
remember was they used the juli Logger services, which are now being 
handled by log4j as I expect.

Because I had forgotten to change server.xml, my entry still looks like 

<Valve className="org.apache.catalina.valves.AccessLogValve"
        prefix="access." suffix=".txt"
        pattern="common" resolveHosts="false"/>

I checked docs/config/valve.html for guidance on using juli or log4j, 
but couldn't find any clues. These, and other, logging-related 
parameters are only documented for AccessLogValve and 

I then looked at the source in tc8 trunk. At first glance, the class 
seems implement a self-contained logging system, complete with daily 
roll-over logic.

I went back as far as the tc5 source in January 2007. There have been 
quite a few changes, but the general idea hasn't changed significantly 
since then.

In fact, the current tc8 source seems to me to use both juli and the 
self-contained logging println service, e.g.

      * Log the specified message to the log file, switching files if 
the date
      * has changed since the previous log call.
      * @param message Message to be logged
     public void log(CharArrayWriter message) {


         /* In case something external rotated the file instead */
         if (checkExists) {
             synchronized (this) {
                 if (currentLogFile != null && !currentLogFile.exists()) {
                     try {
                     } catch (Throwable e) {
                         ExceptionUtils.handleThrowable(e);"accessLogValve.closeFail"), e);

                     /* Make sure date is correct */
                     dateStamp = fileDateFormatter.format(
                             new Date(System.currentTimeMillis()));


         // Log this message
         try {
             synchronized(this) {
                 if (writer != null) {
                     if (!buffered) {
         } catch (IOException ioe) {
                     "accessLogValve.writeFail", message.toString()), ioe);

Am I being stupid? Have I overlooked something obvious?

If not, does anyone have any historical information about this 
implementation? My first thought is that this Valve should simply use 
juli (or log4j via the juli adapter) throughout, just the way the other 
valves already do.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message