public String convert(ILoggingEvent event) { String fqn = getFullyQualifiedName(event); if (abbreviator == null) { return fqn; } else { return abbreviator.abbreviate(fqn); } } }
public void start() { String optStr = getFirstOption(); if (optStr != null) { key = optStr; super.start(); } }
@Override public void stop() { key = null; super.stop(); }
public void start() { int errorCount = 0; String facilityStr = getFirstOption(); if (facilityStr == null) { addError("was expecting a facility string as an option"); return; } facility = SyslogAppenderBase.facilityStringToint(facilityStr); localHostName = getLocalHostname(); try { // hours should be in 0-23, see also http://jira.qos.ch/browse/LBCLASSIC-48 simpleMonthFormat = new SimpleDateFormat("MMM", Locale.US); simpleTimeFormat = new SimpleDateFormat("HH:mm:ss", Locale.US); } catch (IllegalArgumentException e) { addError("Could not instantiate SimpleDateFormat", e); errorCount++; } if (errorCount == 0) { super.start(); } }
public void start() { String optStr = getFirstOption(); if (optStr != null) { try { int targetLen = Integer.parseInt(optStr); if (targetLen == 0) { abbreviator = new ClassNameOnlyAbbreviator(); } else if (targetLen > 0) { abbreviator = new TargetLengthBasedClassNameAbbreviator(targetLen); } } catch (NumberFormatException nfe) { // FIXME: better error reporting } } }
@Override public void start() { String[] keyInfo = extractDefaultReplacement(getFirstOption()); key = keyInfo[0]; if (keyInfo[1] != null) { defaultValue = keyInfo[1]; } super.start(); }
protected ThrowableHandlingConverter createThrowableProxyConverter(LoggerContext context) { if (exceptionFormat == null) { return new RootCauseFirstThrowableProxyConverter(); } ThrowableHandlingConverter throwableHandlingConverter; if (exceptionFormat.isRootFirst()) { throwableHandlingConverter = new RootCauseFirstThrowableProxyConverter(); } else { throwableHandlingConverter = new ExtendedThrowableProxyConverter(); } List<String> options = new ArrayList<>(); // depth must be added first options.add(exceptionFormat.getDepth()); options.addAll(exceptionFormat.getEvaluators()); throwableHandlingConverter.setOptionList(options); throwableHandlingConverter.setContext(context); return throwableHandlingConverter; }
private void printStackLine(StringBuilder buf, int ignoredCount, StackTraceElementProxy element) { buf.append(element); extraData(buf, element); // allow other data to be added if (ignoredCount > 0) { printIgnoredCount(buf, ignoredCount); } }
public void stop() { evaluatorList = null; super.stop(); }
@Override public void start() { throwableProxyConverter.start(); super.start(); }
private void checkRange() { if (depthStart < 0 || depthEnd < 0) { addError("Invalid depthStart/depthEnd range [" + depthStart + ", " + depthEnd + "] (negative values are not allowed)"); } else if (depthStart >= depthEnd) { addError("Invalid depthEnd range [" + depthStart + ", " + depthEnd + "] (start greater or equal to end)"); } }
public PatternLayout() { this.postCompileProcessor = new EnsureExceptionHandling(); }
@Override public void start() { tpc.start(); super.start(); }
/** * This method gets the network name of the machine we are running on. * Returns "UNKNOWN_LOCALHOST" in the unlikely case where the host name * cannot be found. * @return String the name of the local host */ public String getLocalHostname() { try { InetAddress addr = InetAddress.getLocalHost(); return addr.getHostName(); } catch (UnknownHostException uhe) { addError("Could not determine local host name", uhe); return "UNKNOWN_LOCALHOST"; } }
@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); } } }
protected String throwableProxyToString(IThrowableProxy tp) { StringBuilder sb = new StringBuilder(BUILDER_CAPACITY); recursiveAppend(sb, null, ThrowableProxyUtil.REGULAR_EXCEPTION_INDENT, tp); return sb.toString(); }
@Override protected String throwableProxyToString(IThrowableProxy tp) { StringBuilder buf = new StringBuilder(BUILDER_CAPACITY); recursiveAppendRootCauseFirst(buf, null, ThrowableProxyUtil.REGULAR_EXCEPTION_INDENT, tp); return buf.toString(); }
private void subjoinFirstLine(StringBuilder buf, String prefix, int indent, IThrowableProxy tp) { ThrowableProxyUtil.indent(buf, indent - 1); if (prefix != null) { buf.append(prefix); } subjoinExceptionMessage(buf, tp); }
private boolean isRange(String depthStr) { return depthStr.contains(getDefaultRangeDelimiter()); }
@Override public void stop() { super.stop(); throwableProxyConverter.stop(); }