[logback-dev] [Bug 97] New: Avoid printing stack traces under certain conditions
bugzilla-daemon at pixie.qos.ch
bugzilla-daemon at pixie.qos.ch
Wed Sep 19 09:26:26 CEST 2007
http://bugzilla.qos.ch/show_bug.cgi?id=97
Summary: Avoid printing stack traces under certain conditions
Product: logback-classic
Version: unspecified
Platform: PC
OS/Version: Windows
Status: NEW
Severity: enhancement
Priority: P1
Component: Other
AssignedTo: logback-dev at qos.ch
ReportedBy: noreply.ceki at qos.ch
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 {
event = (AuditEvent) ois.readObject();
} 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.
--
Configure bugmail: http://bugzilla.qos.ch/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
More information about the logback-dev
mailing list