Class MDCUtil


  • public class MDCUtil
    extends Object
    MDCUtil is a helper class for managing and copying MDC context across threads so that we can track user/session/IP information for sensitive data access on log statements.
    Author:
    benny
    • Constructor Detail

      • MDCUtil

        public MDCUtil()
        Constructor is called on parent thread so a snapshot of the MDC context is saved here.
    • Method Detail

      • setInstanceId

        public static void setInstanceId​(String instanceId)
        Sets the instanceId into the current MDC context. instanceId usually corresponds to an execution of a report
        Parameters:
        instanceId -
      • getInstanceId

        public static String getInstanceId()
      • setupSchedulerMDC

        public static void setupSchedulerMDC​(Object sessionName,
                                             Object instanceId)
        Sets up the MDC context for threads in the scheduler.
        Parameters:
        sessionName -
        instanceId -
      • setContextMap

        public void setContextMap()
        This is called on a child thread to update the child thread's MDC context with the caller/parent thread's MDC context.
      • clear

        public static void clear()