You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It is nice that spring boot introduced the nested logging with 3.5.0.
Ref : #45063
We actually started going for custom implementation of structured logging to have nested format; but since it is going to be introduced in 3.5.0; we can rely on default implementation.
I tested the nested logging with below format and works with out any issues.
MDC.put("error_details.error_type", "MethodArgumentNotValidException");
MDC.put("error_details.error_code", "10200");
MDC.put("error_details.error_message", "Test error");
MDC.put("error_details.error_description", "Error occurred due to field violation");
How ever; if I do not want "error_details" for further logs in the same request; I need to remove the individual keys separately like below.
Imagine if I have more than 10 keys(or may be more); it is cumbersome to remove all those keys from MDC separately.
It would be nice; to have some thing like below; which will delete all sub keys under "error_details"
MDC.remove("error_details");
Can you please check this.
Tested with Spring Boot 3.5.0-RC1.
The text was updated successfully, but these errors were encountered:
We don't have a way to do this out of the box. The MVC class isn't part of Spring Boot, so we can't change that API. The best suggestion I have for you is to develop your own JsonWriterStructuredLogFormatter implementation based on ours and update the way that contextPairs are written. Perhaps you could do MDC.put("filter_error_details", true) and use that signal to filter all error_details.
Uh oh!
There was an error while loading. Please reload this page.
It is nice that spring boot introduced the nested logging with 3.5.0.
Ref : #45063
We actually started going for custom implementation of structured logging to have nested format; but since it is going to be introduced in 3.5.0; we can rely on default implementation.
I tested the nested logging with below format and works with out any issues.
How ever; if I do not want "error_details" for further logs in the same request; I need to remove the individual keys separately like below.
Imagine if I have more than 10 keys(or may be more); it is cumbersome to remove all those keys from MDC separately.
It would be nice; to have some thing like below; which will delete all sub keys under "error_details"
Can you please check this.
Tested with Spring Boot 3.5.0-RC1.
The text was updated successfully, but these errors were encountered: