SK.gnome.dwarf.http.log
Class DwarfLogFormat

java.lang.Object
  extended bySK.gnome.dwarf.GenericService
      extended bySK.gnome.dwarf.http.log.HTTPLogFormat
          extended bySK.gnome.dwarf.http.log.DwarfLogFormat
All Implemented Interfaces:
SK.gnome.dwarf.Service

public class DwarfLogFormat
extends HTTPLogFormat

Dwarf Log Format.

This is a properietary log format with the following record structure:

  date time remote-addr host remote-user method uri protocol status bytes elapsed referer user-agent
 

This format is very similar to the ExtendedLogFormat, except that this class allows to specify a custom date/time format based on the given locale information and the elapsed time information is in integer number of milliseconds instead of the floating number of seconds.


Field Summary
 
Fields inherited from class SK.gnome.dwarf.http.log.HTTPLogFormat
host, protocol, referer, userAgent
 
Fields inherited from class SK.gnome.dwarf.GenericService
initParameters, parent
 
Fields inherited from interface SK.gnome.dwarf.Service
INITIALIZED, LOG_DEBUG, LOG_ERROR, LOG_FATAL, LOG_INFO, LOG_TRACE, LOG_WARN, LOG_XFER, SHUTDOWN, STARTED, STOPPED
 
Constructor Summary
DwarfLogFormat(java.lang.String name)
          Creates a new DwarfLogFormat.
 
Method Summary
 java.lang.String format(long time, Request request, Response response)
          Formats the HTTP transfer log message.
 void setDateTimeFormat(java.lang.String format)
          Sets the date/time format.
 void setDateTimeFormat(java.lang.String format, java.lang.String language, java.lang.String country)
          Sets the date/time format with the given locale.
 
Methods inherited from class SK.gnome.dwarf.http.log.HTTPLogFormat
setHost, setProtocol, setReferer, setUserAgent
 
Methods inherited from class SK.gnome.dwarf.GenericService
getAuthenticator, getAuthFacility, getFullName, getInitParameter, getInitParameterNames, getLogFacility, getLogger, getName, getParameters, getPrincipal, getShutdownTimeout, getState, init, log, log, login, logout, setAuthFacility, setInitParameters, setLogFacility, shutdown, start, stop, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DwarfLogFormat

public DwarfLogFormat(java.lang.String name)
Creates a new DwarfLogFormat.

Method Detail

setDateTimeFormat

public void setDateTimeFormat(java.lang.String format)
Sets the date/time format.

The format will be based on the US locale.

Parameters:
format - the date/time format

setDateTimeFormat

public void setDateTimeFormat(java.lang.String format,
                              java.lang.String language,
                              java.lang.String country)
Sets the date/time format with the given locale.

The format will be based on a locale created from the given language and country arguments.

Parameters:
format - the date/time format
language - the language
country - the country

format

public java.lang.String format(long time,
                               Request request,
                               Response response)
Description copied from class: HTTPLogFormat
Formats the HTTP transfer log message.

This method must be overriden in order to implement a custom log format. It should read the HTTP-related information from the given request and response objects and create the log message according to them.

The log message returned by this method should include also the date and time information according to the given time argument.

Specified by:
format in class HTTPLogFormat
Parameters:
time - the current time
request - the finished request
response - the finished response
Returns:
the log message


Copyright (c) 1999-2005, Gnome Ltd. All rights reserved.