From 1676bc311f005f5207241d3138d690f05fb19131 Mon Sep 17 00:00:00 2001 From: Nitin Vavdiya Date: Mon, 10 Jul 2023 18:41:53 +0530 Subject: [PATCH] feat: CGD-347: manage log level at runtime --- README.md | 40 +++++++++++++++++- docs/manage_app.png | Bin 0 -> 10881 bytes .../config/security/SecurityConfig.java | 3 +- .../constant/ApplicationRole.java | 2 + src/main/resources/application.yaml | 12 +++++- 5 files changed, 54 insertions(+), 3 deletions(-) create mode 100644 docs/manage_app.png diff --git a/README.md b/README.md index 25f3ea1d0..13b8b567b 100644 --- a/README.md +++ b/README.md @@ -149,6 +149,7 @@ This process ensures that any issues with the database schema are resolved by re | SUPPORTED_FRAMEWORK_VC_TYPES | Supported framework VC, provide values ie type1=value1,type2=value2 | cx-behavior-twin=Behavior Twin,cx-pcf=PCF,cx-quality=Quality,cx-resiliency=Resiliency,cx-sustainability=Sustainability,cx-traceability=ID_3.0_Trace | | ENFORCE_HTTPS_IN_DID_RESOLUTION | Enforce https during web did resolution | true | | CONTRACT_TEMPLATES_URL | Contract templates URL used in summary VC | https://public.catena-x.org/contracts/ | +| APP_LOG_LEVEL | Log level of application | INFO | | | | | ## Technical Debts and Known issue @@ -157,9 +158,46 @@ This process ensures that any issues with the database schema are resolved by re 2. Policies can be validated dynamically as per request while validating VP and VC. [Check this for more details](https://docs.walt.id/v/ssikit/concepts/verification-policies) -3. When you are using MacOS and the MIW docker container won't start up, you can enable the docker-desktop feature "Use Rosetta for x86/amd64 emulation on Apple Silicon" in your Docker settings +3. When you are using MacOS and the MIW docker container won't start up, you can enable the docker-desktop feature "Use + Rosetta for x86/amd64 emulation on Apple Silicon" in your Docker settings (under "features in development") +## Logging in application + +Log level in application can be set using environment variable ``APP_LOG_LEVEL``. Possible values +are ``OFF, ERROR, WARN, INFO, DEBUG, TRACE`` and default value set to ``INFO`` + +### Change log level at runtime using Spring actuator + +We can use ``/actuator/loggers`` API endpoint of actuator for log related things. This end point can be accessible with +role ``manage_app``. We can add this role to authority wallet client using keycloak as below: + +![manage_app.png](docs%2Fmanage_app.png) + +1. API to get current log settings + +```agsl +curl --location 'http://localhost:8090/actuator/loggers' \ +--header 'Authorization: Bearer access_token' +``` + +2. Change log level at runtime + +```agsl + +curl --location 'http://localhost:8090/actuator/loggers/{java package name}' \ +--header 'Content-Type: application/json' \ +--header 'Authorization: Bearer access_token' \ +--data '{"configuredLevel":"INFO"}' + +i.e. + +curl --location 'http://localhost:8090/actuator/loggers/org.eclipse.tractusx.managedidentitywallets' \ +--header 'Content-Type: application/json' \ +--header 'Authorization: Bearer access_token' \ +--data '{"configuredLevel":"INFO"}' +``` + ## Reference of external lib 1. https://www.testcontainers.org/modules/databases/postgres/ diff --git a/docs/manage_app.png b/docs/manage_app.png new file mode 100644 index 0000000000000000000000000000000000000000..2a60b601492f01d05f1e94c76bd091b7a835ed53 GIT binary patch literal 10881 zcmb`NbyOT(m#@1UYrF|A0U8SsoS;FP27)^Y!GjYdK!6}Y8fYZJH6(a|5D2b~yAvS6 zCAfwljXTrt`_0_@&D=ZderwJBr&iUeI#Opz z#+;vlaWTi{k$1TO0JpM=f}Fm$*=|OxBfVkD{?)z%hX<7yxmn69kcF@{zSAe3oKEXL zh+S*0l@WKh| zJrcNbiqFWeIK|pBu4E>5m_$AmGc5nZ-|hV^03TIn6GYp*r`Pd8rhK+7vp)SEBc?}x z6JWPB_#9>;8o8Ir*jSfr!U;phjb{VM;JP9Iw?@`E&~b>any~6q2i09!9qvHlz+Wcu&EKC< z3W$4rSARE#vI@<@U%oLjz8={9p_Q`n@+?J{&?`wc^~BwNv0j=(0qf|Eap8(h{%^z7 z2r~6hz|*rRz%TJNdP1!QALMHExvAl^moj<|JDdRtpbGQ&agLE+_qUfyR%g+^B7`(! zg=mn6{?T~5#NmS{cK{>ouioaKIQFcYr>R7q5oU}lV_)mvRw~uvfcf|CNu_)$!1;P0 z5$G!ECd2_VJz#tu$qZ9c)CV5+I%3;@TRTk!ye<_M-)Hqw678=Av?mt_G0 zFx%W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