Class ServletLogUtility

    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static String composeLogMessage​(javax.servlet.http.HttpServletRequest httpRequest)
      Composes a log message with the method, the client IP address, CORS origin (if any and a CORS Filter is configured) and the security client certificate principal (if any) of an HTTP request.
      static void log​(javax.servlet.http.HttpServletRequest httpRequest)
      Logs (at INFO level) the method, the client IP address, CORS origin (if any and a CORS Filter is configured) and the security client certificate principal (if any) of an HTTP request.
      static void log​(org.apache.logging.log4j.Logger log, javax.servlet.http.HttpServletRequest httpRequest)
      Logs (at INFO level) the method, the client IP address, CORS origin (if any and a CORS Filter is configured) and the security client certificate principal (if any) of an HTTP request.
    • Method Detail

      • composeLogMessage

        public static String composeLogMessage​(javax.servlet.http.HttpServletRequest httpRequest)
        Composes a log message with the method, the client IP address, CORS origin (if any and a CORS Filter is configured) and the security client certificate principal (if any) of an HTTP request.

        Example:

         HTTP POST request: ip=127.0.0.1 path=/json2ldap
         HTTPS POST request: ip=192.168.0.1 path=/authservice
         HTTPS CORS GET request: ip=192.168.0.1 origin=192.168.10.20 path=/json2ldap
         
        Parameters:
        httpRequest - The HTTP request. Must not be null.
        Returns:
        The log message.
      • log

        public static void log​(javax.servlet.http.HttpServletRequest httpRequest)
        Logs (at INFO level) the method, the client IP address, CORS origin (if any and a CORS Filter is configured) and the security client certificate principal (if any) of an HTTP request.

        Example:

         HTTP POST request: ip=127.0.0.1 path=/json2ldap
         HTTPS POST request: ip=192.168.0.1 path=/authservice
         HTTPS CORS GET request: ip=192.168.0.1 origin=192.168.10.20 path=/json2ldap
         
        Parameters:
        httpRequest - The HTTP request to log. If null the method will return immediately.
      • log

        public static void log​(org.apache.logging.log4j.Logger log,
                               javax.servlet.http.HttpServletRequest httpRequest)
        Logs (at INFO level) the method, the client IP address, CORS origin (if any and a CORS Filter is configured) and the security client certificate principal (if any) of an HTTP request.

        Example:

         HTTP POST request: ip=127.0.0.1 path=/json2ldap
         HTTPS POST request: ip=192.168.0.1 path=/authservice
         HTTPS CORS GET request: ip=192.168.0.1 origin=192.168.10.20 path=/json2ldap
         
        Parameters:
        log - The logger. If true the method will return immediately.
        httpRequest - The HTTP request to log. If null the method will return immediately.