Java 类ch.qos.logback.classic.spi.CallerData 实例源码

项目:bartleby    文件:ClassOfCallerConverter.java   
protected String getFullyQualifiedName(ILoggingEvent event) {

  StackTraceElement[] cda = event.getCallerData();
  if (cda != null && cda.length > 0) {
    return cda[0].getClassName();
  } else {
    return CallerData.NA;
  }
}
项目:bartleby    文件:FileOfCallerConverter.java   
public String convert(ILoggingEvent le) {
  StackTraceElement[] cda = le.getCallerData();
  if (cda != null && cda.length > 0) {
    return cda[0].getFileName();
  } else {
    return CallerData.NA;
  }
}
项目:bartleby    文件:MethodOfCallerConverter.java   
public String convert(ILoggingEvent le) {
  StackTraceElement[] cda = le.getCallerData();
  if (cda != null && cda.length > 0) {
    return cda[0].getMethodName();
  } else {
    return CallerData.NA;
  }
}
项目:bartleby    文件:LineOfCallerConverter.java   
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;
  }
}
项目:logback-steno    文件:StenoMethodOfCallerConverter.java   
@Override
public String convert(final ILoggingEvent loggingEvent) {
    final StackTraceElement callerData = getCallerData(loggingEvent);
    if (callerData != null) {
        return callerData.getMethodName();
    }
    return CallerData.NA;
}
项目:logback-steno    文件:StenoFileOfCallerConverter.java   
@Override
public String convert(final ILoggingEvent loggingEvent) {
    final StackTraceElement callerData = getCallerData(loggingEvent);
    if (callerData != null) {
        return callerData.getFileName();
    }
    return CallerData.NA;
}
项目:logback-steno    文件:StenoLineOfCallerConverter.java   
@Override
public String convert(final ILoggingEvent loggingEvent) {
    final StackTraceElement callerData = getCallerData(loggingEvent);
    if (callerData != null) {
        return Integer.toString(callerData.getLineNumber());
    }
    return CallerData.NA;
}
项目:logback-steno    文件:StenoClassOfCallerConverter.java   
@Override
public String convert(final ILoggingEvent loggingEvent) {
    final StackTraceElement callerData = getCallerData(loggingEvent);
    if (callerData != null) {
        return callerData.getClassName();
    }
    return CallerData.NA;
}
项目:bartleby    文件:CallerDataConverter.java   
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;
  }
}
项目:NyBatisCore    文件:StackTracer.java   
public String getClassName() {
    return stackTrace == null ? CallerData.NA : stackTrace.getClassName(); 
}
项目:NyBatisCore    文件:StackTracer.java   
public String getFileName() {
    return stackTrace == null ? CallerData.NA : stackTrace.getFileName(); 
}
项目:NyBatisCore    文件:StackTracer.java   
public String getMethodName() {
    return stackTrace == null ? CallerData.NA : stackTrace.getMethodName(); 
}
项目:NyBatisCore    文件:StackTracer.java   
public String getLineNumber() {
    return stackTrace == null ? CallerData.NA : Integer.toString( stackTrace.getLineNumber() ); 
}
项目:logback-steno    文件:StenoClassOfCallerConverterTest.java   
@Test
public void testNullCallerData() {
    Mockito.doReturn(null).when(_loggingEvent).getCallerData();
    Assert.assertEquals(CallerData.NA, _converter.convert(_loggingEvent));
}
项目:logback-steno    文件:StenoFileOfCallerConverterTest.java   
@Test
public void testNullCallerData() {
    Mockito.doReturn(null).when(_loggingEvent).getCallerData();
    Assert.assertEquals(CallerData.NA, _converter.convert(_loggingEvent));
}
项目:logback-steno    文件:StenoMethodOfCallerConverterTest.java   
@Test
public void testNullCallerData() {
    Mockito.doReturn(null).when(_loggingEvent).getCallerData();
    Assert.assertEquals(CallerData.NA, _converter.convert(_loggingEvent));
}
项目:logback-steno    文件:StenoLineOfCallerConverterTest.java   
@Test
public void testNullCallerData() {
    Mockito.doReturn(null).when(_loggingEvent).getCallerData();
    Assert.assertEquals(CallerData.NA, _converter.convert(_loggingEvent));
}