Class MDCUtil
- java.lang.Object
-
- org.pentaho.platform.engine.core.audit.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
-
-
Field Summary
Fields Modifier and Type Field Description static String
INSTANCE_ID
static String
LOCAL_ADDR
static String
LOCAL_NAME
static String
LOCAL_PORT
static String
REMOTE_ADDR
static String
REMOTE_HOST
static String
REMOTE_PORT
static String
SERVER_NAME
static String
SERVER_PORT
static String
SESSION_ID
static String
SESSION_NAME
-
Constructor Summary
Constructors Constructor Description MDCUtil()
Constructor is called on parent thread so a snapshot of the MDC context is saved here.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static void
clear()
Map<String,String>
getContextMap()
static String
getInstanceId()
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.static void
setInstanceId(String instanceId)
Sets the instanceId into the current MDC context.static void
setupSchedulerMDC(Object sessionName, Object instanceId)
Sets up the MDC context for threads in the scheduler.
-
-
-
Field Detail
-
SESSION_ID
public static final String SESSION_ID
- See Also:
- Constant Field Values
-
REMOTE_ADDR
public static final String REMOTE_ADDR
- See Also:
- Constant Field Values
-
REMOTE_HOST
public static final String REMOTE_HOST
- See Also:
- Constant Field Values
-
REMOTE_PORT
public static final String REMOTE_PORT
- See Also:
- Constant Field Values
-
SERVER_NAME
public static final String SERVER_NAME
- See Also:
- Constant Field Values
-
SERVER_PORT
public static final String SERVER_PORT
- See Also:
- Constant Field Values
-
LOCAL_ADDR
public static final String LOCAL_ADDR
- See Also:
- Constant Field Values
-
LOCAL_NAME
public static final String LOCAL_NAME
- See Also:
- Constant Field Values
-
LOCAL_PORT
public static final String LOCAL_PORT
- See Also:
- Constant Field Values
-
SESSION_NAME
public static final String SESSION_NAME
- See Also:
- Constant Field Values
-
INSTANCE_ID
public static final String INSTANCE_ID
- See Also:
- Constant Field Values
-
-
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()
-
-