protected String getFullyQualifiedName(ILoggingEvent event) { StackTraceElement[] cda = event.getCallerData(); if (cda != null && cda.length > 0) { return cda[0].getClassName(); } else { return CallerData.NA; } }
public String convert(ILoggingEvent le) { StackTraceElement[] cda = le.getCallerData(); if (cda != null && cda.length > 0) { return cda[0].getFileName(); } else { return CallerData.NA; } }
public String convert(ILoggingEvent le) { StackTraceElement[] cda = le.getCallerData(); if (cda != null && cda.length > 0) { return cda[0].getMethodName(); } else { return CallerData.NA; } }
public String convert(ILoggingEvent le) { StackTraceElement[] cda = le.getCallerData(); if (cda != null && cda.length > 0) { return Integer.toString(cda[0].getLineNumber()); } else { return CallerData.NA; } }
@Override public String convert(final ILoggingEvent loggingEvent) { final StackTraceElement callerData = getCallerData(loggingEvent); if (callerData != null) { return callerData.getMethodName(); } return CallerData.NA; }
@Override public String convert(final ILoggingEvent loggingEvent) { final StackTraceElement callerData = getCallerData(loggingEvent); if (callerData != null) { return callerData.getFileName(); } return CallerData.NA; }
@Override public String convert(final ILoggingEvent loggingEvent) { final StackTraceElement callerData = getCallerData(loggingEvent); if (callerData != null) { return Integer.toString(callerData.getLineNumber()); } return CallerData.NA; }
@Override public String convert(final ILoggingEvent loggingEvent) { final StackTraceElement callerData = getCallerData(loggingEvent); if (callerData != null) { return callerData.getClassName(); } return CallerData.NA; }
public String convert(ILoggingEvent le) { StringBuilder buf = new StringBuilder(); if (evaluatorList != null) { boolean printCallerData = false; for (int i = 0; i < evaluatorList.size(); i++) { EventEvaluator<ILoggingEvent> ee = evaluatorList.get(i); try { if (ee.evaluate(le)) { printCallerData = true; break; } } catch (EvaluationException eex) { errorCount++; if (errorCount < MAX_ERROR_COUNT) { addError("Exception thrown for evaluator named [" + ee.getName() + "]", eex); } else if (errorCount == MAX_ERROR_COUNT) { ErrorStatus errorStatus = new ErrorStatus( "Exception thrown for evaluator named [" + ee.getName() + "].", this, eex); errorStatus.add(new ErrorStatus( "This was the last warning about this evaluator's errors." + "We don't want the StatusManager to get flooded.", this)); addStatus(errorStatus); } } } if (!printCallerData) { return CoreConstants.EMPTY_STRING; } } StackTraceElement[] cda = le.getCallerData(); if (cda != null && cda.length > depthStart) { int limit = depthEnd < cda.length ? depthEnd : cda.length; for (int i = depthStart; i < limit; i++) { buf.append(getCallerLinePrefix()); buf.append(i); buf.append("\t at "); buf.append(cda[i]); buf.append(CoreConstants.LINE_SEPARATOR); } return buf.toString(); } else { return CallerData.CALLER_DATA_NA; } }
public String getClassName() { return stackTrace == null ? CallerData.NA : stackTrace.getClassName(); }
public String getFileName() { return stackTrace == null ? CallerData.NA : stackTrace.getFileName(); }
public String getMethodName() { return stackTrace == null ? CallerData.NA : stackTrace.getMethodName(); }
public String getLineNumber() { return stackTrace == null ? CallerData.NA : Integer.toString( stackTrace.getLineNumber() ); }
@Test public void testNullCallerData() { Mockito.doReturn(null).when(_loggingEvent).getCallerData(); Assert.assertEquals(CallerData.NA, _converter.convert(_loggingEvent)); }