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.
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.