diff options
author | Thomas Nelson <nelson24@att.com> | 2019-06-14 19:43:38 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2019-06-14 19:43:38 +0000 |
commit | 9e21ff943f11df4c274b29989f5058c8054a9b39 (patch) | |
tree | bec331227a795e11af014bf372375ab650ae014c | |
parent | d3e986759875605e43acabbb1283270440a1a1a7 (diff) | |
parent | ac3c3123a7d660d85bdcbc013e63b439b430ec42 (diff) |
Merge "Include connection info in log"
-rwxr-xr-x | mdbc-server/src/main/java/org/onap/music/mdbc/MdbcServerLogic.java | 3 | ||||
-rwxr-xr-x | mdbc-server/src/main/resources/logback.xml | 4 |
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"> |