@Override public void start() { int errorCount = 0; if (throwableRenderer == null) { addError("ThrowableRender cannot be null."); errorCount++; } if (errorCount == 0) { super.start(); } }
@Override protected String computeConverterName(Converter c) { if (c instanceof MDCConverter) { MDCConverter mc = (MDCConverter) c; String key = mc.getFirstOption(); if (key != null) { return key; } else { return "MDC"; } } else { return super.computeConverterName(c); } } }
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(); 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(); }
/** * Parses the pattern and creates the Converter linked list. */ @Override public void start() { int errorCount = 0; try { Parser<E> p = new Parser<E>(pattern); p.setContext(getContext()); Node t = p.parse(); this.head = p.compile(t, getEffectiveConverterMap()); ConverterUtil.startConverters(this.head); } catch (ScanException ex) { addError("Incorrect pattern found", ex); errorCount++; } if (errorCount == 0) { super.started = true; } }
/** * Returns a map where the default converter map is merged with the map * contained in the context. */ public Map<String, String> getEffectiveConverterMap() { Map<String, String> effectiveMap = new HashMap<String, String>(); // add the least specific map fist Map<String, String> defaultMap = getDefaultConverterMap(); if (defaultMap != null) { effectiveMap.putAll(defaultMap); } // contextMap is more specific than the default map Context context = getContext(); if (context != null) { @SuppressWarnings("unchecked") Map<String, String> contextMap = (Map<String, String>) context .getObject(CoreConstants.PATTERN_RULE_REGISTRY); if (contextMap != null) { effectiveMap.putAll(contextMap); } } return effectiveMap; }
protected void startNewTableIfLimitReached(StringBuilder sbuf) { if (this.counter >= CoreConstants.TABLE_ROW_LIMIT) { counter = 0; sbuf.append("</table>"); sbuf.append(LINE_SEPARATOR); sbuf.append("<p></p>"); sbuf.append("<table cellspacing=\"0\">"); sbuf.append(LINE_SEPARATOR); buildHeaderRowForTable(sbuf); } }
/** * Returns appropriate HTML headers. */ @Override public String getFileHeader() { StringBuilder sbuf = new StringBuilder(); sbuf.append("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\""); sbuf.append(" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">"); sbuf.append(LINE_SEPARATOR); sbuf.append("<html>"); sbuf.append(LINE_SEPARATOR); sbuf.append(" <head>"); sbuf.append(LINE_SEPARATOR); sbuf.append(" <title>"); sbuf.append(title); sbuf.append("</title>"); sbuf.append(LINE_SEPARATOR); cssBuilder.addCss(sbuf); sbuf.append(LINE_SEPARATOR); sbuf.append(" </head>"); sbuf.append(LINE_SEPARATOR); sbuf.append("<body>"); sbuf.append(LINE_SEPARATOR); return sbuf.toString(); }
public String getPresentationHeader() { StringBuilder sbuf = new StringBuilder(); sbuf.append("<hr/>"); sbuf.append(LINE_SEPARATOR); sbuf.append("<p>Log session start time "); sbuf.append(new java.util.Date()); sbuf.append("</p><p></p>"); sbuf.append(LINE_SEPARATOR); sbuf.append(LINE_SEPARATOR); sbuf.append("<table cellspacing=\"0\">"); sbuf.append(LINE_SEPARATOR); buildHeaderRowForTable(sbuf); return sbuf.toString(); }
@Override protected String computeConverterName(Converter c) { if(c instanceof MDCConverter) { MDCConverter mc = (MDCConverter) c; String key = mc.getFirstOption(); if(key != null) { return key; } else { return "MDC"; } } else { return super.computeConverterName(c); } } }
@Override public void start() { int errorCount = 0; if (throwableRenderer == null) { addError("ThrowableRender cannot be null."); errorCount++; } if (errorCount == 0) { super.start(); } }
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(); 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(); }
protected void startNewTableIfLimitReached(StringBuilder sbuf) { if (this.counter >= CoreConstants.TABLE_ROW_LIMIT) { counter = 0; sbuf.append("</table>"); sbuf.append(LINE_SEPARATOR); sbuf.append("<p></p>"); sbuf.append("<table cellspacing=\"0\">"); sbuf.append(LINE_SEPARATOR); buildHeaderRowForTable(sbuf); } }
private void buildHeaderRowForTable(StringBuilder sbuf) { Converter c = head; String name; sbuf.append("<tr class=\"header\">"); sbuf.append(LINE_SEPARATOR); while (c != null) { name = computeConverterName(c); if (name == null) { c = c.getNext(); continue; } sbuf.append("<td class=\""); sbuf.append(computeConverterName(c)); sbuf.append("\">"); sbuf.append(computeConverterName(c)); sbuf.append("</td>"); sbuf.append(LINE_SEPARATOR); c = c.getNext(); } sbuf.append("</tr>"); sbuf.append(LINE_SEPARATOR); }
@Override public void start() { int errorCount = 0; if (throwableRenderer == null) { addError("ThrowableRender cannot be null."); errorCount++; } if (errorCount == 0) { super.start(); } }
protected void startNewTableIfLimitReached(StringBuilder sbuf) { if (this.counter >= CoreConstants.TABLE_ROW_LIMIT) { counter = 0; sbuf.append("</table>"); sbuf.append(LINE_SEPARATOR); sbuf.append("<p></p>"); sbuf.append("<table cellspacing=\"0\">"); sbuf.append(LINE_SEPARATOR); buildHeaderRowForTable(sbuf); } }
@Override public void start() { int errorCount = 0; if (throwableRenderer == null) { addError("ThrowableRender cannot be null."); errorCount++; } if (errorCount == 0) { super.start(); } }
protected void startNewTableIfLimitReached(StringBuilder sbuf) { if (this.counter >= CoreConstants.TABLE_ROW_LIMIT) { counter = 0; sbuf.append("</table>"); sbuf.append(LINE_SEPARATOR); sbuf.append("<p></p>"); sbuf.append("<table cellspacing=\"0\">"); sbuf.append(LINE_SEPARATOR); buildHeaderRowForTable(sbuf); } }
@Override public void start() { int errorCount = 0; if (throwableRenderer == null) { addError("ThrowableRender cannot be null."); errorCount++; } if (errorCount == 0) { super.start(); } }
protected void startNewTableIfLimitReached(StringBuilder sbuf) { if (this.counter >= CoreConstants.TABLE_ROW_LIMIT) { counter = 0; sbuf.append("</table>"); sbuf.append(LINE_SEPARATOR); sbuf.append("<p></p>"); sbuf.append("<table cellspacing=\"0\">"); sbuf.append(LINE_SEPARATOR); buildHeaderRowForTable(sbuf); } }
protected void startNewTableIfLimitReached(StringBuilder sbuf) { if (this.counter >= CoreConstants.TABLE_ROW_LIMIT) { counter = 0; sbuf.append("</table>"); sbuf.append(LINE_SEPARATOR); sbuf.append("<p></p>"); sbuf.append("<table cellspacing=\"0\">"); sbuf.append(LINE_SEPARATOR); buildHeaderRowForTable(sbuf); } }