org.apache.sling.engine.impl.log
Class RequestLogger

java.lang.Object
  extended by org.apache.sling.engine.impl.log.RequestLogger

@Properties(value={@Property(name="service.description",value="Request Logger"),@Property(name="service.vendor",value="The Apache Software Foundation")})
@Service(value=RequestLogger.class)
@Reference(name="RequestLoggerService",
           referenceInterface=RequestLoggerService.class,
           cardinality=OPTIONAL_MULTIPLE,
           policy=DYNAMIC)
public class RequestLogger
extends Object

The RequestLogger is a request level filter, which provides customizable logging or requests handled by Sling. This filter is inserted as the first filter in the request level filter chain and therefore is the first filter called when processing a request and the last filter acting just before the request handling terminates.


Field Summary
static String PROP_ACCESS_LOG_ENABLED
           
static String PROP_ACCESS_LOG_OUTPUT
           
static String PROP_ACCESS_LOG_OUTPUT_TYPE
           
static String PROP_REQUEST_LOG_ENABLED
           
static String PROP_REQUEST_LOG_OUTPUT
           
static String PROP_REQUEST_LOG_OUTPUT_TYPE
           
 
Constructor Summary
RequestLogger()
           
 
Method Summary
protected  void activate(org.osgi.service.component.ComponentContext osgiContext)
          Activates this component by setting up the special request entry and exit request loggers and the access logger as configured in the context properties.
protected  void bindRequestLoggerService(RequestLoggerService requestLoggerService)
          Binds a RequestLoggerService to be used during request filter.
protected  void deactivate(org.osgi.service.component.ComponentContext osgiContext)
          Deactivates this component by unbinding and shutting down all loggers setup during activation and finally dispose off the FileRequestLog class to make sure all shared writers are closed.
 void logRequestEntry(SlingHttpServletRequest request, SlingHttpServletResponse response)
           
 void logRequestExit(SlingHttpServletRequest request, SlingHttpServletResponse response)
           
protected  void unbindRequestLoggerService(RequestLoggerService requestLoggerService)
          Binds a RequestLoggerService to be used during request filter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROP_REQUEST_LOG_OUTPUT

@Property(value="logs/request.log")
public static final String PROP_REQUEST_LOG_OUTPUT
See Also:
Constant Field Values

PROP_REQUEST_LOG_OUTPUT_TYPE

@Property(intValue=0,
          options={@PropertyOption(name="0",value="Logger Name"),@PropertyOption(name="1",value="File Name"),@PropertyOption(name="2",value="RequestLog Service")})
public static final String PROP_REQUEST_LOG_OUTPUT_TYPE
See Also:
Constant Field Values

PROP_REQUEST_LOG_ENABLED

@Property(boolValue=true)
public static final String PROP_REQUEST_LOG_ENABLED
See Also:
Constant Field Values

PROP_ACCESS_LOG_OUTPUT

@Property(value="logs/access.log")
public static final String PROP_ACCESS_LOG_OUTPUT
See Also:
Constant Field Values

PROP_ACCESS_LOG_OUTPUT_TYPE

@Property(intValue=0,
          options={@PropertyOption(name="0",value="Logger Name"),@PropertyOption(name="1",value="File Name"),@PropertyOption(name="2",value="RequestLog Service")})
public static final String PROP_ACCESS_LOG_OUTPUT_TYPE
See Also:
Constant Field Values

PROP_ACCESS_LOG_ENABLED

@Property(boolValue=true)
public static final String PROP_ACCESS_LOG_ENABLED
See Also:
Constant Field Values
Constructor Detail

RequestLogger

public RequestLogger()
Method Detail

logRequestEntry

public void logRequestEntry(SlingHttpServletRequest request,
                            SlingHttpServletResponse response)

logRequestExit

public void logRequestExit(SlingHttpServletRequest request,
                           SlingHttpServletResponse response)

activate

protected void activate(org.osgi.service.component.ComponentContext osgiContext)
Activates this component by setting up the special request entry and exit request loggers and the access logger as configured in the context properties. In addition the FileRequestLog class is initialized with the value of the sling.home context property to resolve relative log file names.

Parameters:
osgiContext - The OSGi Component Context providing the configuration data and access into the system.

deactivate

protected void deactivate(org.osgi.service.component.ComponentContext osgiContext)
Deactivates this component by unbinding and shutting down all loggers setup during activation and finally dispose off the FileRequestLog class to make sure all shared writers are closed.

Parameters:
osgiContext - The OSGi Component Context providing the configuration data and access into the system.

bindRequestLoggerService

protected void bindRequestLoggerService(RequestLoggerService requestLoggerService)
Binds a RequestLoggerService to be used during request filter.

Parameters:
requestLoggerService - The RequestLoggerService to use.

unbindRequestLoggerService

protected void unbindRequestLoggerService(RequestLoggerService requestLoggerService)
Binds a RequestLoggerService to be used during request filter.

Parameters:
requestLoggerService - The RequestLoggerService to use.


Copyright © 2007-2013 The Apache Software Foundation. All Rights Reserved.