From df26bc38a75f10650ce5785cdc9bd7b9516f6f25 Mon Sep 17 00:00:00 2001 From: sourabh_sourabh Date: Wed, 4 May 2022 11:38:52 +0100 Subject: Security Logging Fields - logback encoder and sleuth dependencies are added. - New appender is added to log JSON format content on console. Issue-ID: CPS-986 Signed-off-by: sourabh_sourabh Change-Id: Id7e4d836188da54b94144076a8755e4a2643a7ad --- src/main/resources/application.yml | 3 ++ src/main/resources/logback-spring.xml | 75 +++++++++++++++++++++++++++++++++++ 2 files changed, 78 insertions(+) create mode 100644 src/main/resources/logback-spring.xml (limited to 'src/main') diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 71a689cd..8be97d2d 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -39,6 +39,8 @@ security: # This is a known issue with springfox and springboot introduced in 2.6.x: # https://github.com/springfox/springfox/issues/3462 spring: + application: + name: ncmp-dmi-plugin mvc: pathmatch: matching-strategy: ANT_PATH_MATCHER @@ -89,6 +91,7 @@ sdnc: password: ${SDNC_PASSWORD} logging: + format: json level: org.springframework: ERROR org.onap.cps: DEBUG diff --git a/src/main/resources/logback-spring.xml b/src/main/resources/logback-spring.xml new file mode 100644 index 00000000..355209b4 --- /dev/null +++ b/src/main/resources/logback-spring.xml @@ -0,0 +1,75 @@ + + + + + + + + + + + + + + + + + + true + + { + "logTimeStamp": "${currentTimeStamp:-}", + "logTypeName": "", + "logLevel": "%level", + "traceId": "%X{traceId:-}", + "statusCode": "", + "principalId": "${username:-}", + "serviceName": "${springAppName:-}", + "message": "%message", + "spanId": "%X{spanId:-}", + "processId": "${PID:-}", + "threadName": "%thread", + "class": "%logger{40}", + "exception": "%wEx" + } + + + + + + + + + + + + + + + + + + + + + + -- cgit 1.2.3-korg