Details
-
Improvement
-
Resolution: Unresolved
-
Minor
-
None
-
None
-
None
-
Operating System: Windows
Platform: PC
-
97
Description
It would be useful if under certain very specific conditions, logback avoided printing stack traces.
In particular, in server applications IOEXceptions are thrown under normal conditions, such as when the client closes its connection to the server.
Typical code would look like:
try
catch (java.io.EOFException e)
{ logger.info("Caught java.io.EOFException closing connection.", e); break; }catch (IOException e)
{ logger.info("Caught java.io.IOException: ", e); break; }catch (ClassNotFoundException e)
{ logger.error("Unexpected ClassNotFoundException.", e); writeResponse(e); break; }Most of the time we would like to avoid printing the stack trace for the two exceptions but not the third.
Possible solution:
Marker ignoreST = MarkerFactgory.getMarker("IGNORE_STACK_TRACE");
logger.info(ignoreST, "Caught java.io.EOFException closing connection.", e);
Note that even if most of the time we would like to avoid printing the stack trace, it should still be possible to allow st printing by overriding some parameter.