com.mortbay.HTTP.Handler
Class LogHandler

java.lang.Object
  |
  +--com.mortbay.HTTP.Handler.NullHandler
        |
        +--com.mortbay.HTTP.Handler.LogHandler

public class LogHandler
extends NullHandler
implements java.util.Observer

log handler

This Handler logs all requests to Writers in a "standard" format

Notes

As dynamic pages often do not have Content-Length set, the log handler has the option of installing a output filter to count the character sent on each request. This does involve some additional overhead, so it should only be used if the statistics are required.

Version:
$Id: LogHandler.java,v 2.10 2000/06/02 23:41:05 gregw Exp $
Author:
Greg Wilkins
See Also:
Interface.HttpHandler

Fields inherited from class com.mortbay.HTTP.Handler.NullHandler
httpServer
 
Constructor Summary
LogHandler(boolean countContentLength, boolean longForm)
          Constructor
LogHandler(java.util.Properties properties)
          Constructor from properties.
 
Method Summary
 void handle(HttpRequest request, HttpResponse response)
          Constructor
 void setProperties(java.util.Properties properties)
          Configure from properties.
 void update(java.util.Observable o, java.lang.Object arg)
          Observer update called by HttpResponse
 
Methods inherited from class com.mortbay.HTTP.Handler.NullHandler
destroy, getProperties, servlet, servletNames, setServer, translate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LogHandler

public LogHandler(java.util.Properties properties)
Constructor from properties. Calls setProperties.

LogHandler

public LogHandler(boolean countContentLength,
                  boolean longForm)
Constructor
Parameters:
countContentLength - if true the output is filtered for the content size.
longForm - if true, output is in the long form aka Netscape
Method Detail

setProperties

public void setProperties(java.util.Properties properties)
Configure from properties. Format of properties is expected to be that of a PropertyTree with the following root nodes:
File - The filename of the log. "err" and "out" are special file names that log to System.err and System.out. The filename "com.mortbay.Base.Log" outputs to com.mortbay.Base.Log.
Append - Boolean, if true append to the log file.
LongForm - Boolean, if true the log is the long format
DateFormat - Simple date format. If not present, use the format in the request.
CountContentLength - Boolean, if true count the bytes of replies without a content length header (expensive).
Overrides:
setProperties in class NullHandler
Parameters:
properties - configuration.

handle

public void handle(HttpRequest request,
                   HttpResponse response)
            throws java.lang.Exception
Description copied from interface: HttpHandler
Constructor
Overrides:
handle in class NullHandler
Tags copied from interface: HttpHandler
Parameters:
request - The HTTP requests to be handled
response - The HTTP response to be used.

update

public void update(java.util.Observable o,
                   java.lang.Object arg)
Observer update called by HttpResponse
Specified by:
update in interface java.util.Observer