Details
-
Bug
-
Resolution: Unresolved
-
Minor
-
None
-
1.2.3
-
None
-
Logback 1.2.3
Spring boot webapp, with Logback configured to log to ConsoleAppender
Description
Problem
In a webapp uncaught exceptions are handled (logged) by the servlet container (Tomcat in our case).
However, Logback `TeeFilter` has the following code:
try { // ... (omitted) filterChain.doFilter(teeRequest, teeResponse); // ... (omitted) } catch (IOException e) { e.printStackTrace(); throw e; } catch (ServletException e) { e.printStackTrace(); throw e; }
This causes the stack trace to appear twice in the console (once logged by TeeFilter, and once by Tomcat).
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.