Class NavigationLogger

  • All Implemented Interfaces:
    INavigationLogger
    Direct Known Subclasses:
    BannerLogger

    public class NavigationLogger
    extends java.lang.Object
    implements INavigationLogger
    A logger to log the accesses in the W3C Extended format.

    This logger uses log4j, and to generate the log in the proper format, it must be configured to generate the header "#Fields: date time c-ip cs-username s-computername s-ip s-port cs-method cs-uri-stem cs-uri-query sc-status sc-bytes cs-bytes time-taken cs-version cs-host cs(User-Agent) cs(Cookie) cs(Referer)%n" and use the pattern "%m%n".

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected ILogger navigationLogger
      The logger where the navigation log messages are sent to.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected java.lang.String encodeToW3cLog​(java.lang.String pStr)
      Encodes the String to a w3c log entry value.
      protected void generateLogURI​(javax.servlet.http.HttpServletRequest request, java.lang.StringBuilder logOutput, SessionConfig sessionConfig, PageConfig pageConfig, ITransaction transaction)  
      void logAccess​(javax.servlet.http.HttpServletRequest request, SessionConfig sessionConfig, PageConfig pageConfig, ITransaction transaction)
      Logs an entry in the navigation log with the access information relative to the given request.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • navigationLogger

        protected ILogger navigationLogger
        The logger where the navigation log messages are sent to.
    • Constructor Detail

      • NavigationLogger

        public NavigationLogger()
    • Method Detail

      • logAccess

        public void logAccess​(javax.servlet.http.HttpServletRequest request,
                              SessionConfig sessionConfig,
                              PageConfig pageConfig,
                              ITransaction transaction)
        Description copied from interface: INavigationLogger
        Logs an entry in the navigation log with the access information relative to the given request.
        Specified by:
        logAccess in interface INavigationLogger
        Parameters:
        request - the request of the access to be logged.
      • generateLogURI

        protected void generateLogURI​(javax.servlet.http.HttpServletRequest request,
                                      java.lang.StringBuilder logOutput,
                                      SessionConfig sessionConfig,
                                      PageConfig pageConfig,
                                      ITransaction transaction)
      • encodeToW3cLog

        protected java.lang.String encodeToW3cLog​(java.lang.String pStr)
        Encodes the String to a w3c log entry value. If the string is null or an empty String, a '-' is returned. Else its space characters are replaced by '+'.
        Parameters:
        pStr - the string to be encoded.
        Returns:
        the encoded string.