aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xmdbc-server/src/main/java/org/onap/music/mdbc/MdbcServerLogic.java3
-rwxr-xr-xmdbc-server/src/main/resources/logback.xml4
2 files changed, 5 insertions, 2 deletions
diff --git a/mdbc-server/src/main/java/org/onap/music/mdbc/MdbcServerLogic.java b/mdbc-server/src/main/java/org/onap/music/mdbc/MdbcServerLogic.java
index 8f79840..4e5a1d0 100755
--- a/mdbc-server/src/main/java/org/onap/music/mdbc/MdbcServerLogic.java
+++ b/mdbc-server/src/main/java/org/onap/music/mdbc/MdbcServerLogic.java
@@ -90,6 +90,7 @@ public class MdbcServerLogic extends JdbcMeta{
@Override
protected Connection getConnection(String id) throws SQLException {
+ logger.mdcPut("ConnectionId", id);
if (id == null) {
throw new NullPointerException("Connection id is null");
}
@@ -106,6 +107,7 @@ public class MdbcServerLogic extends JdbcMeta{
@Override
public void openConnection(ConnectionHandle ch, Map<String, String> information) {
+ logger.mdcPut("ConnectionId", ch.id);
Properties fullInfo = new Properties();
fullInfo.putAll(this.info);
if (information != null) {
@@ -157,6 +159,7 @@ public class MdbcServerLogic extends JdbcMeta{
connectionCache.invalidate(ch.id);
this.manager.closeConnection(ch.id);
logger.info("connection closed with id {}", ch.id);
+ logger.mdcRemove("ConnectionId");
}
}
diff --git a/mdbc-server/src/main/resources/logback.xml b/mdbc-server/src/main/resources/logback.xml
index b9e9dcf..df5bc5b 100755
--- a/mdbc-server/src/main/resources/logback.xml
+++ b/mdbc-server/src/main/resources/logback.xml
@@ -82,11 +82,11 @@
value="%date{yyyy-MM-dd'T'HH:mm:ss.SSSXXX}|%X{RequestId}|%thread|%X{ServiceName}|%X{PartnerName}|%X{TargetEntity}|%X{TargetServiceName}|%X{class}|%X{AlertSeverity}|%X{ErrorCode}|%X{ErrorDescription}| %msg%n" />
<property name="defaultLoggerPattern"
- value="%date{yyyy-MM-dd'T'HH:mm:ss.SSSXXX}|%X{RequestId}|%thread|%X{class}| %msg%n" />
+ value="%date{yyyy-MM-dd'T'HH:mm:ss.SSSXXX}|%X{RequestId}|%thread|%X{class}|%X{ConnectionId}| %msg%n" />
<!-- use %class so library logging calls yield their class name -->
<property name="applicationLoggerPattern"
- value="%date{yyyy-MM-dd'T'HH:mm:ss.SSSXXX}|%X{RequestId}|%thread|%X{class}| %msg%n" />
+ value="%date{yyyy-MM-dd'T'HH:mm:ss.SSSXXX}|%X{RequestId}|%thread|%X{class}|%X{ConnectionId}| %msg%n" />
<!-- Example evaluator filter applied against console appender -->
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">