Class AbstractRequestLogger

  • All Implemented Interfaces:
    IRequestLogger
    Direct Known Subclasses:
    RequestLogger

    public abstract class AbstractRequestLogger
    extends java.lang.Object
    implements IRequestLogger
    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 JSON format.

    • Constructor Detail

      • AbstractRequestLogger

        public AbstractRequestLogger()
        Construct.
    • Method Detail

      • objectCreated

        public void objectCreated​(java.lang.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
      • objectRemoved

        public void objectRemoved​(java.lang.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
      • objectUpdated

        public void objectUpdated​(java.lang.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
      • 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
      • sessionCreated

        public void sessionCreated​(java.lang.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
      • sessionDestroyed

        public void sessionDestroyed​(java.lang.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
      • logEventTarget

        public void logEventTarget​(org.apache.wicket.request.IRequestHandler requestHandler)
        Description copied from interface: IRequestLogger
        Sets the target that was the event target for the current request
        Specified by:
        logEventTarget in interface IRequestLogger
        Parameters:
        requestHandler - the event target
      • logRequestedUrl

        public void logRequestedUrl​(java.lang.String url)
        Description copied from interface: IRequestLogger
        Logs the URL that was requested by the browser.
        Specified by:
        logRequestedUrl in interface IRequestLogger
        Parameters:
        url - the requested URL
      • logResponseTarget

        public void logResponseTarget​(org.apache.wicket.request.IRequestHandler requestHandler)
        Description copied from interface: IRequestLogger
        Sets the target that was the response target for the current request
        Specified by:
        logResponseTarget in interface IRequestLogger
        Parameters:
        requestHandler - the response target
      • formatDate

        protected java.lang.String formatDate​(java.util.Date date)
        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