@Test public void testFormatWithMessageAndThrownLeftToRight() { LogRecord record = new LogRecord(Level.SEVERE, "message"); record.setThrown(new Throwable("thrown")); CompactFormatter cf = new CompactFormatter(); String result = cf.format(record); assertTrue(result, result.startsWith(record.getMessage())); assertTrue(result, result.contains("|")); assertTrue(result, result.contains(Throwable.class.getSimpleName())); assertTrue(result, result.contains(CompactFormatterTest.class.getSimpleName())); assertTrue(result, result.contains("testFormatWithMessageAndThrown")); assertTrue(result, result.contains(String.valueOf( record.getThrown().getStackTrace()[0].getLineNumber()))); assertTrue(result, result.endsWith(LINE_SEP)); }
@Override public String format(final LogRecord record) { ResourceBundle rb = record.getResourceBundle(); Locale l = rb == null ? null : rb.getLocale(); String msg = formatMessage(record); String thrown = formatThrown(record); Object[] params = { new Date(record.getMillis()), formatSource(record), formatLoggerName(record), formatLevel(record), msg, thrown, new Alternate(msg, thrown), new Alternate(thrown, msg)}; return String.format(l, fmt, params); }
CompactFormatter extends java.util.logging.Formatter { @Override public String format(final LogRecord record) { ResourceBundle rb = record.getResourceBundle(); Locale l = rb == null ? null : rb.getLocale(); String msg = formatMessage(record); String thrown = formatThrown(record); Object[] params = { new Date(record.getMillis()), formatSource(record), formatLoggerName(record), formatLevel(record), msg, thrown, new Alternate(msg, thrown), new Alternate(thrown, msg)}; return String.format(l, fmt, params); } }
CompactFormatter extends java.util.logging.Formatter { @Override public String format(final LogRecord record) { ResourceBundle rb = record.getResourceBundle(); Locale l = rb == null ? null : rb.getLocale(); String msg = formatMessage(record); String thrown = formatThrown(record); Object[] params = { new Date(record.getMillis()), formatSource(record), formatLoggerName(record), formatLevel(record), msg, thrown, new Alternate(msg, thrown), new Alternate(thrown, msg)}; return String.format(l, fmt, params); } CompactFormatter();  CompactFormatter(final String format); }
CompactFormatter extends java.util.logging.Formatter { @Override public String format(final LogRecord record) { ResourceBundle rb = record.getResourceBundle(); Locale l = rb == null ? null : rb.getLocale(); String msg = formatMessage(record); String thrown = formatThrown(record); Object[] params = { new Date(record.getMillis()), formatSource(record), formatLoggerName(record), formatLevel(record), msg, thrown, new Alternate(msg, thrown), new Alternate(thrown, msg)}; return String.format(l, fmt, params); } CompactFormatter();  CompactFormatter(final String format); @Override String format(final LogRecord record); @Override String formatMessage(final LogRecord record); String formatMessage(final Throwable t); String formatLevel(final LogRecord record); String formatSource(final LogRecord record); String formatLoggerName(final LogRecord record); String formatThrown(final LogRecord record); String formatBackTrace(LogRecord record); }
CompactFormatter extends java.util.logging.Formatter { @Override public String format(final LogRecord record) { ResourceBundle rb = record.getResourceBundle(); Locale l = rb == null ? null : rb.getLocale(); String msg = formatMessage(record); String thrown = formatThrown(record); Object[] params = { new Date(record.getMillis()), formatSource(record), formatLoggerName(record), formatLevel(record), msg, thrown, new Alternate(msg, thrown), new Alternate(thrown, msg)}; return String.format(l, fmt, params); } CompactFormatter();  CompactFormatter(final String format); @Override String format(final LogRecord record); @Override String formatMessage(final LogRecord record); String formatMessage(final Throwable t); String formatLevel(final LogRecord record); String formatSource(final LogRecord record); String formatLoggerName(final LogRecord record); String formatThrown(final LogRecord record); String formatBackTrace(LogRecord record);  }