org.apache.wicket.protocol.http
Class RequestLogger

java.lang.Object
  extended by org.apache.wicket.protocol.http.RequestLogger
All Implemented Interfaces:
IRequestLogger

public class RequestLogger
extends Object
implements IRequestLogger

This is the logger class that can be set in the Application.getRequestLogger() method. If this class is set all request and live sessions will be recorded and displayed From the total created sessions, to the peak session count and the current livesessions. For the livesessions the request logger will record what request are happening what kind of IRequestTarget was the event target and what IRequestTarget was the response target. It also records what session data was touched for this and how long the request did take. To view this information live see the InspectorBug that shows the InspectorPage with the LiveSessionsPage

Since:
1.2
Author:
jcompagner

Nested Class Summary
static interface RequestLogger.ISessionLogInfo
          This interface can be implemented in a custom session object.
static class RequestLogger.SessionData
          This class hold the information one request of a session has.
 
Nested classes/interfaces inherited from interface org.apache.wicket.protocol.http.IRequestLogger
IRequestLogger.RequestData
 
Field Summary
protected static org.slf4j.Logger log
          log.
 
Constructor Summary
RequestLogger()
          Construct.
 
Method Summary
protected  AppendingStringBuffer createLogString(IRequestLogger.RequestData rd, RequestLogger.SessionData sd, boolean includeRuntimeInfo)
           
 int getCurrentActiveRequestCount()
           
 RequestLogger.SessionData[] getLiveSessions()
           
 int getPeakActiveRequestCount()
           
 int getPeakSessions()
           
 List<IRequestLogger.RequestData> getRequests()
          This method returns a List of the current requests that are in mem.
 int getTotalCreatedSessions()
           
protected  void log(IRequestLogger.RequestData rd, RequestLogger.SessionData sd)
           
 void logEventTarget(IRequestTarget target)
          Sets the target that was the event target for the current request
 void logResponseTarget(IRequestTarget target)
          Sets the target that was the response target for the current request
 void objectCreated(Object value)
          Called to monitor additions of objects in the ISessionStore
 void objectRemoved(Object value)
          Called to monitor removals of objects out of the ISessionStore
 void objectUpdated(Object value)
          Called to monitor updates of objects in the ISessionStore
 void requestTime(long timeTaken)
          This method is called when the request is over.
 void sessionCreated(String sessionId)
          called when the session is created and has an id.
 void sessionDestroyed(String sessionId)
          Method used to cleanup a livesession when the session was invalidated by the webcontainer
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected static org.slf4j.Logger log
log.

Constructor Detail

RequestLogger

public RequestLogger()
Construct.

Method Detail

getTotalCreatedSessions

public int getTotalCreatedSessions()
Specified by:
getTotalCreatedSessions in interface IRequestLogger
Returns:
The total created sessions counter
See Also:
IRequestLogger.getTotalCreatedSessions()

getPeakSessions

public int getPeakSessions()
Specified by:
getPeakSessions in interface IRequestLogger
Returns:
The peak sessions counter
See Also:
IRequestLogger.getPeakSessions()

getCurrentActiveRequestCount

public int getCurrentActiveRequestCount()
Specified by:
getCurrentActiveRequestCount in interface IRequestLogger
Returns:
The current active requests
See Also:
IRequestLogger.getCurrentActiveRequestCount()

getPeakActiveRequestCount

public int getPeakActiveRequestCount()
Specified by:
getPeakActiveRequestCount in interface IRequestLogger
Returns:
The peak active requests
See Also:
IRequestLogger.getPeakActiveRequestCount()

getRequests

public List<IRequestLogger.RequestData> getRequests()
Description copied from interface: IRequestLogger
This method returns a List of the current requests that are in mem. This is a readonly list.

Specified by:
getRequests in interface IRequestLogger
Returns:
Collection of the current requests
See Also:
IRequestLogger.getRequests()

getLiveSessions

public RequestLogger.SessionData[] getLiveSessions()
Specified by:
getLiveSessions in interface IRequestLogger
Returns:
Collection of live Sessions Data

sessionDestroyed

public void sessionDestroyed(String sessionId)
Description copied from interface: IRequestLogger
Method used to cleanup a livesession when the session was invalidated by the webcontainer

Specified by:
sessionDestroyed in interface IRequestLogger
Parameters:
sessionId - the session id
See Also:
IRequestLogger.sessionDestroyed(java.lang.String)

sessionCreated

public void sessionCreated(String sessionId)
Description copied from interface: IRequestLogger
called when the session is created and has an id. (for http it means that the http session is created)

Specified by:
sessionCreated in interface IRequestLogger
Parameters:
sessionId - the session id
See Also:
IRequestLogger.sessionDestroyed(java.lang.String)

requestTime

public void requestTime(long timeTaken)
Description copied from interface: IRequestLogger
This method is called when the request is over. This will set the total time a request takes and cleans up the current request data.

Specified by:
requestTime in interface IRequestLogger
Parameters:
timeTaken - the time taken in milliseconds
See Also:
IRequestLogger.requestTime(long)

log

protected void log(IRequestLogger.RequestData rd,
                   RequestLogger.SessionData sd)
Parameters:
rd -
sd -

createLogString

protected AppendingStringBuffer createLogString(IRequestLogger.RequestData rd,
                                                RequestLogger.SessionData sd,
                                                boolean includeRuntimeInfo)

objectRemoved

public void objectRemoved(Object value)
Description copied from interface: IRequestLogger
Called to monitor removals of objects out of the ISessionStore

Specified by:
objectRemoved in interface IRequestLogger
Parameters:
value - the object being removed
See Also:
IRequestLogger.objectRemoved(java.lang.Object)

objectUpdated

public void objectUpdated(Object value)
Description copied from interface: IRequestLogger
Called to monitor updates of objects in the ISessionStore

Specified by:
objectUpdated in interface IRequestLogger
Parameters:
value - the object being updated
See Also:
IRequestLogger.objectUpdated(java.lang.Object)

objectCreated

public void objectCreated(Object value)
Description copied from interface: IRequestLogger
Called to monitor additions of objects in the ISessionStore

Specified by:
objectCreated in interface IRequestLogger
Parameters:
value - the object being created/added
See Also:
IRequestLogger.objectCreated(java.lang.Object)

logResponseTarget

public void logResponseTarget(IRequestTarget target)
Description copied from interface: IRequestLogger
Sets the target that was the response target for the current request

Specified by:
logResponseTarget in interface IRequestLogger
Parameters:
target - the response target
See Also:
IRequestLogger.logResponseTarget(org.apache.wicket.IRequestTarget)

logEventTarget

public void logEventTarget(IRequestTarget target)
Description copied from interface: IRequestLogger
Sets the target that was the event target for the current request

Specified by:
logEventTarget in interface IRequestLogger
Parameters:
target - the event target
See Also:
IRequestLogger.logEventTarget(org.apache.wicket.IRequestTarget)


Copyright © 2004-2011 Apache Software Foundation. All Rights Reserved.