@Test public void testDoLayout() throws Exception { ILoggingEvent le = createLoggingEvent(); String result = layout.getFileHeader(); result += layout.getPresentationHeader(); result += layout.doLayout(le); result += layout.getPresentationFooter(); result += layout.getFileFooter(); Document doc = parseOutput(result); Element rootElement = doc.getRootElement(); rootElement.toString(); assertEquals(2, rootElement.elements().size()); Element bodyElement = (Element) rootElement.elements().get(1); Element tableElement = (Element) bodyElement.elements().get(3); assertEquals("table", tableElement.getName()); Element trElement = (Element) tableElement.elements().get(1); { Element tdElement = (Element) trElement.elements().get(0); assertEquals("DEBUG", tdElement.getText()); } { Element tdElement = (Element) trElement.elements().get(1); String regex = ClassicTestConstants.NAKED_MAIN_REGEX; System.out.println(tdElement.getText()); assertTrue(tdElement.getText().matches(regex)); } { Element tdElement = (Element) trElement.elements().get(2); assertEquals("test message", tdElement.getText()); } }
public String doLayout(ILoggingEvent event) { StringBuilder buf = new StringBuilder(); startNewTableIfLimitReached(buf); boolean odd = true; if (((counter++) & 1) == 0) { odd = false; } String level = event.getLevel().toString().toLowerCase(Locale.US); buf.append(LINE_SEPARATOR); buf.append("<tr class=\""); buf.append(level); if (odd) { buf.append(" odd\">"); } else { buf.append(" even\">"); } buf.append(LINE_SEPARATOR); Converter<ILoggingEvent> c = head; while (c != null) { appendEventToBuffer(buf, c, event); c = c.getNext(); } buf.append("</tr>"); buf.append(LINE_SEPARATOR); if (event.getThrowableProxy() != null) { throwableRenderer.render(buf, event); } return buf.toString(); }
HTMLLayout extends HTMLLayoutBase<ILoggingEvent> { public String doLayout(ILoggingEvent event) { StringBuilder buf = new StringBuilder(); startNewTableIfLimitReached(buf); boolean odd = true; if (((counter++) & 1) == 0) { odd = false; } String level = event.getLevel().toString().toLowerCase(Locale.US); buf.append(LINE_SEPARATOR); buf.append("<tr class=\""); buf.append(level); if (odd) { buf.append(" odd\">"); } else { buf.append(" even\">"); } buf.append(LINE_SEPARATOR); Converter<ILoggingEvent> c = head; while (c != null) { appendEventToBuffer(buf, c, event); c = c.getNext(); } buf.append("</tr>"); buf.append(LINE_SEPARATOR); if (event.getThrowableProxy() != null) { throwableRenderer.render(buf, event); } return buf.toString(); } }
HTMLLayout extends HTMLLayoutBase<ILoggingEvent> { public String doLayout(ILoggingEvent event) { StringBuilder buf = new StringBuilder(); startNewTableIfLimitReached(buf); boolean odd = true; if (((counter++) & 1) == 0) { odd = false; } String level = event.getLevel().toString().toLowerCase(Locale.US); buf.append(LINE_SEPARATOR); buf.append("<tr class=\""); buf.append(level); if (odd) { buf.append(" odd\">"); } else { buf.append(" even\">"); } buf.append(LINE_SEPARATOR); Converter<ILoggingEvent> c = head; while (c != null) { appendEventToBuffer(buf, c, event); c = c.getNext(); } buf.append("</tr>"); buf.append(LINE_SEPARATOR); if (event.getThrowableProxy() != null) { throwableRenderer.render(buf, event); } return buf.toString(); } HTMLLayout(); }
HTMLLayout extends HTMLLayoutBase<ILoggingEvent> { public String doLayout(ILoggingEvent event) { StringBuilder buf = new StringBuilder(); startNewTableIfLimitReached(buf); boolean odd = true; if (((counter++) & 1) == 0) { odd = false; } String level = event.getLevel().toString().toLowerCase(Locale.US); buf.append(LINE_SEPARATOR); buf.append("<tr class=\""); buf.append(level); if (odd) { buf.append(" odd\">"); } else { buf.append(" even\">"); } buf.append(LINE_SEPARATOR); Converter<ILoggingEvent> c = head; while (c != null) { appendEventToBuffer(buf, c, event); c = c.getNext(); } buf.append("</tr>"); buf.append(LINE_SEPARATOR); if (event.getThrowableProxy() != null) { throwableRenderer.render(buf, event); } return buf.toString(); } HTMLLayout(); @Override void start(); String doLayout(ILoggingEvent event); IThrowableRenderer<ILoggingEvent> getThrowableRenderer(); void setThrowableRenderer(IThrowableRenderer<ILoggingEvent> throwableRenderer); }
HTMLLayout extends HTMLLayoutBase<ILoggingEvent> { public String doLayout(ILoggingEvent event) { StringBuilder buf = new StringBuilder(); startNewTableIfLimitReached(buf); boolean odd = true; if (((counter++) & 1) == 0) { odd = false; } String level = event.getLevel().toString().toLowerCase(Locale.US); buf.append(LINE_SEPARATOR); buf.append("<tr class=\""); buf.append(level); if (odd) { buf.append(" odd\">"); } else { buf.append(" even\">"); } buf.append(LINE_SEPARATOR); Converter<ILoggingEvent> c = head; while (c != null) { appendEventToBuffer(buf, c, event); c = c.getNext(); } buf.append("</tr>"); buf.append(LINE_SEPARATOR); if (event.getThrowableProxy() != null) { throwableRenderer.render(buf, event); } return buf.toString(); } HTMLLayout(); @Override void start(); String doLayout(ILoggingEvent event); IThrowableRenderer<ILoggingEvent> getThrowableRenderer(); void setThrowableRenderer(IThrowableRenderer<ILoggingEvent> throwableRenderer);  }