Knotx / knotx

Knot.x is a highly-efficient and scalable integration framework designed to build backend APIs
https://knotx.io
Apache License 2.0
126 stars 26 forks source link

Response code logging tweaks - different log levels for success, redi… #427

Closed scypio closed 6 years ago

scypio commented 6 years ago

…rect and error responses

Currently every response from repository that return HTTP status code different than 200 is logged using ERROR logger level. The strategy has been adjusted.

Description

2xx - success - log at debug 3xx - redirect - log at info 4xx - client error - log at warn 5xx - server error - log at error other - log at warn

https://github.com/Cognifide/knotx/issues/423

Motivation and Context

Too many error messages may trigger unwanted warnings for devops. Error log level should indicate that something is wrong.

Screenshots (if appropriate):

Types of changes

Checklist:


I hereby agree to the terms of the Knot.x Contributor License Agreement.

malaskowski commented 6 years ago

Thank you @scypio for this fix.

mateuszgrab-cognifide commented 6 years ago

Would it be possible to add information about requested resource while logging response? The issue I have is that it makes no sense in some cases to log every request, however it is good to know what resource was requested if there was >= 400 response code.

malaskowski commented 6 years ago

What do you think about adding request path (especially in warn and error level) in the message? I think that might be useful.

scypio commented 6 years ago

@Skejven @mateuszgrab-cognifide I added request URL logging for 4xx, 5xx response codes