Package org.somda.sdc.common.logging
Class InstanceLogger
- java.lang.Object
-
- org.somda.sdc.common.logging.InstanceLogger
-
public class InstanceLogger extends Object
Logger which adds instance specific information to every log message using the CloseableThreadContext.
-
-
Field Summary
Fields Modifier and Type Field Description static StringINSTANCE_IDThe key which is used in the thread context to communicate the instance identifier.
-
Constructor Summary
Constructors Constructor Description InstanceLogger()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static org.apache.logging.log4j.LoggerwrapLogger(org.apache.logging.log4j.Logger logger, String instanceId)Wraps a logger into a proxy which adds context information to all messages.
-
-
-
Field Detail
-
INSTANCE_ID
public static final String INSTANCE_ID
The key which is used in the thread context to communicate the instance identifier.
-
-
Method Detail
-
wrapLogger
public static org.apache.logging.log4j.Logger wrapLogger(org.apache.logging.log4j.Logger logger, String instanceId)Wraps a logger into a proxy which adds context information to all messages.- Parameters:
logger- to wrapinstanceId- to add to all messages- Returns:
- wrapped logger instance
-
-