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

Dynamic Log Level configuration for specific Packages #71

Closed KarstenSchnitter closed 4 years ago

KarstenSchnitter commented 4 years ago

This PR adresses #68.

The dynamic log level feature allows changes of the log level by a JWT token in an HTTP request. This allows e.g. debug output for a specific request. However, the filtering will allow all log messages of the provided log level to be emitted. To increase control about which classes will generate log messages at finer granularity two new filters are provided. They allow a comma-separated list of package names, for which the dynamic log level will be applied. The JWT token is extended by a claim packages, that takes the list.

Extending the existing filters was not an option, since they globally reject all messages not matching the required log level. In the new approach the statically configured rules on log levels still need to be applied. The user can therefore choose, which logging filter is to be used.

KarstenSchnitter commented 4 years ago

I wrote a small sample app to verify correct functionality for both logging backends. It will become part of this repository in the future.