Class LoggingUtil


  • public final class LoggingUtil
    extends Object
    PingFederate sdks can use this utility class to write to audit log.
    Since:
    10.0
    • Method Detail

      • init

        public static void init()
        Initiate an audit log event. Audit log parameters can be filled in during the life cycle of the event. The audit log will be written to disk when the write method is invoked. It is the responsibility of the caller to clear the thread local parameters.
      • log

        public static void log​(String msg)
        Log a message.
        Parameters:
        msg -
        Since:
        10.0
      • cleanup

        public static void cleanup()
        Clears the thread's local parameters filled during and after initialization.
        Since:
        10.0
      • setStatus

        public static void setStatus​(String status)
        Set a status for the log entry.
        Parameters:
        status -
        Since:
        10.0
      • setUserName

        public static void setUserName​(String username)
        Set the username. The substitution name for the @{username} in audit log is subject.
        Parameters:
        username -
        Since:
        10.0
      • setPartnerId

        public static void setPartnerId​(String partnerId)
        Sets the partner id. The substitution name for {@param partnerId} in audit log is connectionid .
        Parameters:
        partnerId -
        Since:
        10.0
      • setInMessageContext

        public static void setInMessageContext​(String inMessageContext)
        Sets the incoming message context id. The substitution name for {@param inMessageContext} in audit log is inxmlmsg .
        Parameters:
        inMessageContext -
        Since:
        10.0
      • setOutMessageContext

        public static void setOutMessageContext​(String outMessageContext)
        Sets the outgoing message context. The substitution name for {@param outMessageContext} in audit log is outxmlmsg .
        Parameters:
        outMessageContext -
        Since:
        10.0
      • setHost

        public static void setHost​(String host)
        Set the hostname.
        Parameters:
        host -
        Since:
        10.0
      • setRemoteAddress

        public static void setRemoteAddress​(String remoteAddress)
        Set the remote address.
        Parameters:
        remoteAddress -
        Since:
        10.0
      • setProtocol

        public static void setProtocol​(String protocol)
        Set the protocol.
        Parameters:
        protocol -
        Since:
        10.0
      • setRequestStartTime

        public static void setRequestStartTime​(Long startTime)
        Set the request start time.
        Parameters:
        startTime -
        Since:
        10.0
      • updateResponseTime

        public static void updateResponseTime()
        Update the response time using current time and the requestStartTime.
        Since:
        10.0
      • setEvent

        public static void setEvent​(String event)
        Set the event type.
        Parameters:
        event -
        Since:
        10.0
      • getEvent

        public static String getEvent()
        Get the type of event being logged.
        Since:
        10.0
      • setDescription

        public static void setDescription​(String description)
        Set the description for log entry.
        Parameters:
        description -
        Since:
        10.0
      • setRole

        public static void setRole​(String role)
        Set the logging server's role such as, AS (Authorisation Server), IdP (Identity Provider), SP (Service Provider).
        Parameters:
        role -
        Since:
        10.0
      • setAccessTokenJti

        public static void setAccessTokenJti​(String jti)
        Sets the jti of an outbound JWT access token.
        Parameters:
        jti - the jti of an outbound JWT access token
        Since:
        11.3
      • setRequestJti

        public static void setRequestJti​(String jti)
        Sets the jti of inbound JWT access token.
        If the thread already has this parameter set, then the new value will be appended to it using a comma separator.
        Parameters:
        jti - the jti of inbound JWT access token
        Since:
        11.3
      • calculateHashForLogging

        public static String calculateHashForLogging​(String value)
        Calculates a hash for the given value. The calculated hash can be used for logging.
        Parameters:
        value - the value to hash
        Returns:
        the generated hash, or null if the given value is blank
        Since:
        11.3