micronaut-projects / micronaut-core

Micronaut Application Framework
http://micronaut.io
Apache License 2.0
6k stars 1.04k forks source link

a setting to override RouteExecutor isIgnorable #8181

Open tituschu0628 opened 1 year ago

tituschu0628 commented 1 year ago

Feature description

Hello,

We current set our micronaut logging level to INFO. The RouteExecutor decides to log connection related exceptions (regex IGNORABLE_ERROR_MESSAGE) to DEBUG. I understand the intention to reduce the amount of logs (https://github.com/micronaut-projects/micronaut-core/issues/5224) but what if I want to see these errors without changing logging level? The 2 possible solutions I have is: 1 extend the ErrorResponseProcessor 2 implement a ExceptionHandler<Throwable, HttpResponse<?>> in either of these I then check the exception with isIgnorable() which I copy from RouteExecutor, and print them to ERROR/WARN if its ignored

Is there no simplier way to achieve this? A configuration or toggle that override isIgnorable or log to another level would be nice. I wish I didn't have to create classes just to change behavior of 1 line (logException(cause); in createDefaultErrorResponse()

yawkat commented 1 year ago

i dont think this should be a config setting, changing the log level seems fine. do you need to configure this separately from other DEBUG-level messages of io.micronaut.http.server.RouteExecutor? we could add a marker or something.

tituschu0628 commented 1 year ago

for our case, we do want to stay at INFO over time, our logs started to become too chatty and we decided to change many of our log messages from INFO to DEBUG to clean up clutter changing level to DEBUG would defeat that

if we don't care to use createDefaultErrorResponse anymore, then yes I don't have to worry about isIgnorable and just log.error everything, but it means we won't use RouteExecutor's default behavior

yawkat commented 1 year ago

you can change the log level for individual classes. you dont need to log DEBUG level everywhere.

tituschu0628 commented 1 year ago

i see i see, thanks for the suggestions i'll take a look at the whole RouteExecutor class first