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:
User Guide - Access logging, java.util.logging

Constructor Summary
LogService()
          Constructor.
LogService(boolean enabled)
          Constructor.
 
Method Summary
 Filter createInboundFilter(Context context)
          Create the filter that should be invoked for incoming calls.
 String getLogFormat()
          Returns the format used.
 String getLoggerName()
          Returns the name of the JDK's logger to use when logging access calls.
 Reference getLogPropertiesRef()
          Returns the URI reference of the log properties.
 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(String format)
          Sets the format to use when logging calls.
 void setLoggerName(String name)
          Sets the name of the JDK's logger to use when logging access calls.
 void setLogPropertiesRef(Reference logPropertiesRef)
          Sets the URI reference of the log properties.
 void setLogPropertiesRef(String logPropertiesUri)
          Sets the URI reference of the log properties.
 void start()
          Starts the log service by attempting to read the log properties if the getLogPropertiesRef() returns a non null URI reference.
 
Methods inherited from class org.restlet.service.Service
createOutboundFilter, getContext, isEnabled, isStarted, isStopped, setContext, setEnabled, stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LogService

public LogService()
Constructor.


LogService

public LogService(boolean enabled)
Constructor.

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

createInboundFilter

public Filter createInboundFilter(Context context)
Description copied from class: Service
Create the filter that should be invoked for incoming calls.

Overrides:
createInboundFilter in class Service
Parameters:
context - The current context.
Returns:
The new filter or null.

getLogFormat

public 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 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.

getLogPropertiesRef

public Reference getLogPropertiesRef()
Returns the URI reference of the log properties.

Returns:
The URI reference of the log properties.

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(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(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.

setLogPropertiesRef

public void setLogPropertiesRef(Reference logPropertiesRef)
Sets the URI reference of the log properties.

Parameters:
logPropertiesRef - The URI reference of the log properties.

setLogPropertiesRef

public void setLogPropertiesRef(String logPropertiesUri)
Sets the URI reference of the log properties.

Parameters:
logPropertiesUri - The URI reference of the log properties.

start

public void start()
           throws Exception
Starts the log service by attempting to read the log properties if the getLogPropertiesRef() returns a non null URI reference.

Overrides:
start in class Service
Throws:
Exception


Copyright © 2005-2011 Noelios Technologies.