[logback-dev] [JIRA] Updates for LOGBACK-1527: TeeFilter prints stack traces of uncaught exceptions to the standard erorr stream
QOS.CH (JIRA)
noreply-jira at qos.ch
Fri Oct 2 19:05:00 CEST 2020
logback / LOGBACK-1527 [Open]
TeeFilter prints stack traces of uncaught exceptions to the standard erorr stream
==============================
Here's what changed in this issue in the last few minutes.
This issue has been created
This issue is now assigned to you.
View or comment on issue using this link
https://jira.qos.ch/browse/LOGBACK-1527
==============================
Issue created
------------------------------
Gediminas Rimsa created this issue on 02/Oct/20 6:51 PM
Summary: TeeFilter prints stack traces of uncaught exceptions to the standard erorr stream
Issue Type: Bug
Affects Versions: 1.2.3
Assignee: Logback dev list
Components: logback-access
Created: 02/Oct/20 6:51 PM
Environment:
Logback 1.2.3
Spring boot webapp, with Logback configured to log to ConsoleAppender
Priority: Minor
Reporter: Gediminas Rimsa
Description:
h2. Problem
In a webapp uncaught exceptions are handled (logged) by the servlet container (Tomcat in our case).
However, Logback `TeeFilter` has the following code:
{code:java}
try {
// ... (omitted)
filterChain.doFilter(teeRequest, teeResponse);
// ... (omitted)
} catch (IOException e) {
e.printStackTrace();
throw e;
} catch (ServletException e) {
e.printStackTrace();
throw e;
}
{code}
This causes the stack trace to appear twice in the console (once logged by TeeFilter, and once by Tomcat).
h2. Proposed solution
# Remove `e.printStackTrace();` statements from `TeeFilter` - it has no responsibility of printing stack traces of exceptions it can not handle
# Also replace `System.out.println` statements with logging to SLF4J API at INFO level
I'd be happy to raise a PR for this if a new version of logback-access would be released soon after the fix.
==============================
This message was sent by Atlassian Jira (v8.8.0#808000-sha1:e2c7e59)
More information about the logback-dev
mailing list