Package org.apache.wicket.protocol.http
Class AbstractRequestLogger
java.lang.Object
org.apache.wicket.protocol.http.AbstractRequestLogger
- All Implemented Interfaces:
IRequestLogger
- Direct Known Subclasses:
RequestLogger
Base class that collects request and session information for request logging to enable rich
information about the events that transpired during a single request. Typical HTTPD and/or
Servlet container log files are unusable for determining what happened in the application since
they contain the requested URLs of the form http://example.com/app?wicket:interface:0:0:0, which
doesn't convey any useful information. Requestloggers can show which page was the target of the
request, and which page was rendered as a response, and anything else: resources, Ajax request,
etc.
The information in the log files can take any format, depending on the request logger
implementation: currently Wicket supports two formats: a legacy, log4j
compatible format
, and a JsonRequestLogger JSON format.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.wicket.protocol.http.IRequestLogger
IRequestLogger.ISessionLogInfo, IRequestLogger.RequestData, IRequestLogger.SessionData
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
protected String
formatDate
(Date date) Thread-safely formats the passed date in format 'yyyy-MM-dd hh:mm:ss,SSS' with GMT timezonelong
int
int
int
This method returns a List of the current requests that are in mem.long
int
protected abstract void
void
logEventTarget
(IRequestHandler requestHandler) Sets the target that was the event target for the current requestvoid
logRequestedUrl
(String url) Logs the URL that was requested by the browser.void
logResponseTarget
(IRequestHandler requestHandler) Sets the target that was the response target for the current requestvoid
objectCreated
(Object value) Called to monitor additions of objects in theISessionStore
void
objectRemoved
(Object value) Called to monitor removals of objects out of theISessionStore
void
objectUpdated
(Object value) Called to monitor updates of objects in theISessionStore
void
Perform the actual loggingvoid
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
-
Constructor Details
-
AbstractRequestLogger
public AbstractRequestLogger()Construct.
-
-
Method Details
-
getCurrentActiveRequestCount
- Specified by:
getCurrentActiveRequestCount
in interfaceIRequestLogger
- Returns:
- The current active requests
-
getPeakActiveRequestCount
- Specified by:
getPeakActiveRequestCount
in interfaceIRequestLogger
- Returns:
- The peak active requests
-
getLiveSessions
- Specified by:
getLiveSessions
in interfaceIRequestLogger
- Returns:
- Collection of live Sessions Data
-
getPeakSessions
- Specified by:
getPeakSessions
in interfaceIRequestLogger
- Returns:
- The peak sessions counter
-
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 interfaceIRequestLogger
- Returns:
- Collection of the current requests
-
getTotalCreatedSessions
- Specified by:
getTotalCreatedSessions
in interfaceIRequestLogger
- Returns:
- The total created sessions counter
-
objectCreated
Description copied from interface:IRequestLogger
Called to monitor additions of objects in theISessionStore
- Specified by:
objectCreated
in interfaceIRequestLogger
- Parameters:
value
- the object being created/added
-
objectRemoved
Description copied from interface:IRequestLogger
Called to monitor removals of objects out of theISessionStore
- Specified by:
objectRemoved
in interfaceIRequestLogger
- Parameters:
value
- the object being removed
-
objectUpdated
Description copied from interface:IRequestLogger
Called to monitor updates of objects in theISessionStore
- Specified by:
objectUpdated
in interfaceIRequestLogger
- Parameters:
value
- the object being updated
-
requestTime
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 interfaceIRequestLogger
- Parameters:
timeTaken
- the time taken in milliseconds
-
sessionCreated
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 interfaceIRequestLogger
- Parameters:
sessionId
- the session id
-
sessionDestroyed
Description copied from interface:IRequestLogger
Method used to cleanup a livesession when the session was invalidated by the webcontainer- Specified by:
sessionDestroyed
in interfaceIRequestLogger
- Parameters:
sessionId
- the session id
-
getCurrentRequest
- Specified by:
getCurrentRequest
in interfaceIRequestLogger
- Returns:
- The
IRequestLogger.RequestData
for the current request.
-
performLogging
Description copied from interface:IRequestLogger
Perform the actual logging- Specified by:
performLogging
in interfaceIRequestLogger
-
log
-
addRequest
-
getAverageRequestTime
- Specified by:
getAverageRequestTime
in interfaceIRequestLogger
- Returns:
- The average request time.
-
getRequestsPerMinute
- Specified by:
getRequestsPerMinute
in interfaceIRequestLogger
- Returns:
- The number of requests per minute.
-
logEventTarget
Description copied from interface:IRequestLogger
Sets the target that was the event target for the current request- Specified by:
logEventTarget
in interfaceIRequestLogger
- Parameters:
requestHandler
- the event target
-
logRequestedUrl
Description copied from interface:IRequestLogger
Logs the URL that was requested by the browser.- Specified by:
logRequestedUrl
in interfaceIRequestLogger
- Parameters:
url
- the requested URL
-
logResponseTarget
Description copied from interface:IRequestLogger
Sets the target that was the response target for the current request- Specified by:
logResponseTarget
in interfaceIRequestLogger
- Parameters:
requestHandler
- the response target
-
formatDate
Thread-safely formats the passed date in format 'yyyy-MM-dd hh:mm:ss,SSS' with GMT timezone- Parameters:
date
- the date to format- Returns:
- the formatted date
-