Package org.somda.sdc.common.logging
Class InstanceLogger
java.lang.Object
org.somda.sdc.common.logging.InstanceLogger
Logger which adds instance specific information to every log message using the CloseableThreadContext.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe key which is used in the thread context to communicate the instance identifier. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic 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 Details
-
INSTANCE_ID
The key which is used in the thread context to communicate the instance identifier.
-
-
Constructor Details
-
InstanceLogger
public InstanceLogger()
-
-
Method Details
-
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
-