org.restlet.service
Class LogService

java.lang.Object
  extended by org.restlet.service.Service
      extended by org.restlet.service.LogService

public class LogService
extends Service

Service providing access logging service. The implementation is fully based on the standard logging mechanism introduced in JDK 1.4.

The default access log format follows the W3C Extended Log File Format with the following fields used:

  1. Date (YYYY-MM-DD)
  2. Time (HH:MM:SS)
  3. Client address (IP)
  4. Remote user identifier (see RFC 1413)
  5. Server address (IP)
  6. Server port
  7. Method (GET|POST|...)
  8. Resource reference path (including the leading slash)
  9. Resource reference query (excluding the leading question mark)
  10. Response status code
  11. Number of bytes sent
  12. Number of bytes received
  13. Time to serve the request (in milliseconds)
  14. Host reference
  15. Client agent name
  16. Referrer reference

If you use Analog to generate your log reports, and if you use the default log format, then you can simply specify this string as a value of the LOGFORMAT command: (%Y-%m-%d\t%h:%n:%j\t%S\t%u\t%j\t%j\t%j\t%r\t%q\t%c\t%b\t%j\t%T\t%v\t%B\t%f)

For custom access log format, see the syntax to use and the list of available variable names in Template.

Author:
Jerome Louvel
See Also:
Tutorial: Access logging, Wiki: Logging, java.util.logging

Constructor Summary
LogService(boolean enabled)
          Constructor.
 
Method Summary
 java.lang.String getLogFormat()
          Returns the format used.
 java.lang.String getLoggerName()
          Returns the name of the JDK's logger to use when logging access calls.
 boolean isIdentityCheck()
          Indicates if the identity check (as specified by RFC1413) is enabled.
 void setIdentityCheck(boolean identityCheck)
          Indicates if the identity check (as specified by RFC1413) is enabled.
 void setLogFormat(java.lang.String format)
          Sets the format to use when logging calls.
 void setLoggerName(java.lang.String name)
          Sets the name of the JDK's logger to use when logging access calls.
 
Methods inherited from class org.restlet.service.Service
isEnabled, isStarted, isStopped, setEnabled, start, stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LogService

public LogService(boolean enabled)
Constructor.

Parameters:
enabled - True if the service has been enabled.
Method Detail

getLogFormat

public java.lang.String getLogFormat()
Returns the format used.

Returns:
The format used, or null if the default one is used.
See Also:
for format syntax and variables.

getLoggerName

public java.lang.String getLoggerName()
Returns the name of the JDK's logger to use when logging access calls. The default name will follow this pattern: "org.restlet.MyComponent.LogService", where "MyComponent" will correspond to the simple class name of your component subclass or to the base "Component" class.

Returns:
The name of the JDK's logger to use when logging access calls.

isIdentityCheck

public boolean isIdentityCheck()
Indicates if the identity check (as specified by RFC1413) is enabled. Default value is false.

Returns:
True if the identity check is enabled.

setIdentityCheck

public void setIdentityCheck(boolean identityCheck)
Indicates if the identity check (as specified by RFC1413) is enabled.

Parameters:
identityCheck - True if the identity check is enabled.

setLogFormat

public void setLogFormat(java.lang.String format)
Sets the format to use when logging calls. The default format matches the one of IIS 6.

Parameters:
format - The format to use when loggin calls.
See Also:
for format syntax and variables.

setLoggerName

public void setLoggerName(java.lang.String name)
Sets the name of the JDK's logger to use when logging access calls.

Parameters:
name - The name of the JDK's logger to use when logging access calls.


Copyright © 2005-2008 Noelios Technologies.