diff options
author | Tschaen, Brendan <ctschaen@att.com> | 2019-06-11 14:26:58 -0400 |
---|---|---|
committer | Tschaen, Brendan <ctschaen@att.com> | 2019-06-11 14:26:58 -0400 |
commit | ac3c3123a7d660d85bdcbc013e63b439b430ec42 (patch) | |
tree | 7c09d1f685cc6b5a557ce805e1c6b9e9bd2156e9 /mdbc-server | |
parent | 65b45cafb4dff93bef52e91f2ab3f2a772e4472e (diff) |
Include connection info in log
Issue-ID: MUSIC-409
Signed-off-by: Tschaen, Brendan <ctschaen@att.com>
Change-Id: I4d84d7cbc407f314f22b7a659dc499b23375c470
Diffstat (limited to 'mdbc-server')
-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"> |