@Test public void testFormatMaxThrowableWidthLeftToRight() { String fmt = LEFT_TO_RIGHT; int width = MAX_PRE; assertTrue(fmt, fmt.contains(Integer.toString(width))); assertTrue(String.valueOf(width), width < Integer.MAX_VALUE / 4); CompactFormatter cf = new CompactFormatter(fmt); LogRecord record = new LogRecord(Level.SEVERE, ""); int padding = LINE_SEP.length(); for (int i = 0; i < width; i++) { record.setThrown(new Throwable(rpad("", i, "A"))); String result = cf.format(record); assertTrue(result, result.length() <= width + padding); assertTrue(result, result.endsWith(LINE_SEP)); } for (int i = width; i <= (width * 4); i++) { record.setThrown(new Throwable(rpad("", i, "A"))); String result = cf.format(record); assertTrue(result.length() + ", " + (width + padding), result.length() == width + padding); 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);  }