Dynamic | User case Based logging

56 views Asked by At

Is there any logging framework, which helps me change logging levels dynamically based on the request parameters received ?

If request has a parameter with debug enabled to true, then only it should log, else not.

Does spring sleuth provide this feature in cloud environment?

2

There are 2 answers

0
Marcin Grzejszczak On

You can use Spring Boot & Spring Cloud Config and standard Slf4j logging mechanism. You can check out this answer for more information - Managing logging.level using ConfigServer

0
jmehrens On

If you just want conditional logging you would use a NDC/MDC and a filter using the frameworks that support that feature.

If you want something more general then for instance, setup a com.foo.request that is set to say INFO and a com.foo.request.debug that is set to some lower level. Pick and choose the logger on request parameter.