Logging a stacktrace


try {
Something that throws an Exception
} catch (final XxxException e) {
LOG.error("Some message", e);
}

or

try {
Something that throws an Exception
} catch (final XxxException e) {
final StringWriter w = new StringWriter(10000);
final PrintWriter pw = new PrintWriter(w);
e.printStackTrace(pw);
// Do something with 'w' which now
// contains the formatted stacktrace
}

Comments

Popular posts from this blog

Sites, Newsletters, and Blogs

Oracle JDBC ReadTimeout QueryTimeout

Locks held on Oracle for hours after sessions abnormally terminated by node failure