SAP / cf-java-logging-support

The Java Logging Support for Cloud Foundry supports the creation of structured log messages and the collection of request metrics
Apache License 2.0
77 stars 48 forks source link

Provide extension points for custom JWT post-processings #69

Closed KarstenSchnitter closed 4 years ago

KarstenSchnitter commented 4 years ago

Introduction

The dynamic log level feature uses JWT tokens from HTTP headers to specify the desired log level. These JWT tokens are validated and decoded to extract the relevant information. If a developer wants to extract further information from the same JWT token, this process cannot easily be accessed. This limits the possibility to extract more fields to enrich the log messages with, e.g. a tenant id. Furthermore, a developer may want to apply own checks on the validity of the log level change and execute own login, e.g. create audit logs.

Proposal

Allow developers to access the decode JWT tokens by subclassing DynamicLogLevelProcessor. Introduce overloadable methods to allow further validation and actions by the subclass. Furthermore, extend RequestLoggingFilter to allow registration or creation of a custom extension of DynamicLogLevelProcessor.