@Override /* Formatter */ public String format(LogRecord r) { String msg = formatMessage(r); Throwable t = r.getThrown(); String hash = null; int c = 0; if (hashes != null && t != null) { hash = hashCode(t); hashes.putIfAbsent(hash, new AtomicInteger(0)); c = hashes.get(hash).incrementAndGet(); if (c == 1) { msg = '[' + hash + '.' + c + "] " + msg; } else { msg = '[' + hash + '.' + c + "] " + msg + ", " + t.getLocalizedMessage(); t = null; } } String s = String.format(format, df.format(new Date(r.getMillis())), r.getSourceClassName(), r.getSourceMethodName(), r.getLoggerName(), r.getLevel(), msg, r.getThreadID(), r.getThrown() == null ? "" : r.getThrown().getMessage()); if (t != null) s += String.format("%n%s", getStackTrace(r.getThrown())); return s; }
@Override /* Formatter */ public String format(LogRecord r) { String msg = formatMessage(r); Throwable t = r.getThrown(); String hash = null; int c = 0; if (hashes != null && t != null) { hash = hashCode(t); hashes.putIfAbsent(hash, new AtomicInteger(0)); c = hashes.get(hash).incrementAndGet(); if (c == 1) { msg = '[' + hash + '.' + c + "] " + msg; } else { msg = '[' + hash + '.' + c + "] " + msg + ", " + t.getLocalizedMessage(); t = null; } } String s = String.format(format, df.format(new Date(r.getMillis())), r.getSourceClassName(), r.getSourceMethodName(), r.getLoggerName(), r.getLevel(), msg, r.getThreadID(), r.getThrown() == null ? "" : r.getThrown().getMessage()); if (t != null) s += String.format("%n%s", getStackTrace(r.getThrown())); return s; }
public static final void assertContains(Exception e, String...substrings) { for (String substring : substrings) { Throwable e2 = e; boolean found = false; while (e2 != null && ! found) { found |= contains(e2.getMessage(), substring); e2 = e2.getCause(); } if (! found) { e.printStackTrace(); throw new ComparisonFailure("Exception message did not contain expected substring.", toString(substring), StringUtils.getStackTrace(e)); } } }
throw e; } catch (Exception e) { return "Exception: " + getStackTrace(e);
throw e; } catch (Exception e) { return "Exception: " + getStackTrace(e);
throw e; } catch (Exception e) { return "Exception: " + getStackTrace(e);