LUT-31354: Do not log the stacktrace when the size limit for an upload is exceeded#598
LUT-31354: Do not log the stacktrace when the size limit for an upload is exceeded#598rzara wants to merge 1 commit intolutece-platform:develop7.xfrom
Conversation
…d is exceeded The stacktrace does not add relevant information, and thus pollutes the log file.
|
For SizeLimitExceededException, this is a predictable error (user error). The error level may be excessive — a warn or debug level would be more appropriate. However, it's still important to log the exception itself (not just the message) to preserve the stack trace, which is useful for debugging and monitoring purposes in case of unexpected issues or patterns. AppLogService.warn( "Size limit error for upload: {}", e.getMessage( ) ); |
|
My point is that the stack trace adds no useful information. Besides, |
|
To reiterate the point, |
|
I understand your point regarding the limited usefulness of the stack trace for SizeLimitExceededException, since it indeed always originates from the same place. Regarding the log level, we can certainly add a warning level to AppLogService, or use another appropriate level — but not error in this specific case. In my previous example, I simply forgot to pass the exception as an argument. Furthermore, in a production environment, the recommended practice is to use the error level. This avoids polluting the logs and allows for much more efficient log analysis. Using a lower level systematically (info, …) can not only reduce log readability but also have performance implications. |
|
This exception in this case would not be swallowed, but handled in two ways:
|
The stacktrace does not add relevant information, and thus pollutes the log file.