/** * Get the caller information for this logging event. If caller information is * null at the time of its invocation, this method extracts location * information. The collected information is cached for future use. * <p/> * <p> * Note that after serialization it is impossible to correctly extract caller * information. * </p> */ public StackTraceElement[] getCallerData() { if (callerDataArray == null) { callerDataArray = CallerData .extract(new Throwable(), fqnOfLoggerClass, loggerContext.getMaxCallerDataDepth(), loggerContext.getFrameworkPackages()); } return callerDataArray; }
/** * Get the caller information for this logging event. If caller information is * null at the time of its invocation, this method extracts location * information. The collected information is cached for future use. * <p/> * <p> * Note that after serialization it is impossible to correctly extract caller * information. * </p> */ public StackTraceElement[] getCallerData() { if (callerDataArray == null) { callerDataArray = CallerData.extract(new Throwable(), fqnOfLoggerClass, loggerContext.getMaxCallerDataDepth(), loggerContext.getFrameworkPackages()); } return callerDataArray; }
/** * Get the caller information for this logging event. If caller information is * null at the time of its invocation, this method extracts location * information. The collected information is cached for future use. * * <p> Note that after serialization it is impossible to correctly extract * caller information. </p> */ public StackTraceElement[] getCallerData() { if (callerDataArray == null) { callerDataArray = CallerData.extract(new Throwable(), fqnOfLoggerClass, loggerContext.getMaxCallerDataDepth()); } return callerDataArray; }
/** * Get the caller information for this logging event. If caller information is * null at the time of its invocation, this method extracts location * information. The collected information is cached for future use. * * <p> * Note that after serialization it is impossible to correctly extract caller * information. * </p> */ public StackTraceElement[] getCallerData() { if (callerDataArray == null) { callerDataArray = CallerData.extract(new Throwable(), fqnOfLoggerClass, loggerContext.getMaxCallerDataDepth()); } return callerDataArray; }
/** * Using the previous Logback API (prior to 1.0.10) * * @param logger * @return */ private static StackTraceElement[] toCallerDataOld(Logger logger) { final String name = Logger.class.getName(); final LoggerContext context = logger.getLoggerContext(); StackTraceElement[] ste = null; try { // Logback 1.0.7 Class<?> c = Class.forName("ch.qos.logback.classic.spi.CallerData"); Method m = c.getMethod("extract", Throwable.class, String.class, Integer.TYPE); m.invoke(null, new Throwable(), name, context.getMaxCallerDataDepth()); } catch (Exception ex) { // ignore on purpose } return ste; }
/** * Get the caller information for this logging event. If caller information is * null at the time of its invocation, this method extracts location * information. The collected information is cached for future use. * <p> * Note that after serialization it is impossible to correctly extract caller * information. * </p> */ public StackTraceElement[] getCallerData() { if (callerDataArray == null) { callerDataArray = CallerData.extract(new Throwable(), fqnOfLoggerClass, loggerContext.getMaxCallerDataDepth(), loggerContext.getFrameworkPackages()); } return callerDataArray; }
StackTraceElement[] getCallerData0(StackTraceElement stackTraceElement) { StackTraceElement[] callerData = CallerData.extract( new Throwable(), org.osgi.service.log.Logger.class.getName(), loggerContext.getMaxCallerDataDepth(), loggerContext.getFrameworkPackages()); if (stackTraceElement != null) { if (callerData.length == 0) { callerData = new StackTraceElement[] {stackTraceElement}; } else { StackTraceElement[] copy = new StackTraceElement[callerData.length + 1]; copy[0] = stackTraceElement; System.arraycopy(callerData, 0, copy, 1, callerData.length); callerData = copy; } } return callerData; }
/** * Get the caller information for this logging event. If caller information is * null at the time of its invocation, this method extracts location * information. The collected information is cached for future use. * <p/> * <p> * Note that after serialization it is impossible to correctly extract caller * information. * </p> */ public StackTraceElement[] getCallerData() { if (callerDataArray == null) { callerDataArray = CallerData .extract(new Throwable(), fqnOfLoggerClass, loggerContext.getMaxCallerDataDepth(), loggerContext.getFrameworkPackages()); } return callerDataArray; }
/** * Get the caller information for this logging event. If caller information is * null at the time of its invocation, this method extracts location * information. The collected information is cached for future use. * <p/> * <p> * Note that after serialization it is impossible to correctly extract caller * information. * </p> */ public StackTraceElement[] getCallerData() { if (callerDataArray == null) { callerDataArray = CallerData .extract(new Throwable(), fqnOfLoggerClass, loggerContext.getMaxCallerDataDepth(), loggerContext.getFrameworkPackages()); } return callerDataArray; }
/** * Get the caller information for this logging event. If caller information is * null at the time of its invocation, this method extracts location * information. The collected information is cached for future use. * <p/> * <p> * Note that after serialization it is impossible to correctly extract caller * information. * </p> */ public StackTraceElement[] getCallerData() { if (callerDataArray == null) { callerDataArray = CallerData .extract(new Throwable(), fqnOfLoggerClass, loggerContext.getMaxCallerDataDepth(), loggerContext.getFrameworkPackages()); } return callerDataArray; }
/** * Generate the stack trace element for an event. * * <p>The actual work is delegated to the {@link CallerData#extract(Throwable, String, int)} method. * * @param logger the logger for the event. * @return the stack trace element */ private static StackTraceElement[] toCallerData(Logger logger) { StackTraceElement[] ste = null; if (_fallbackOnOldCallerDataExtract) { try { final String name = Logger.class.getName(); final LoggerContext context = logger.getLoggerContext(); ste = CallerData.extract(new Throwable(), name, context.getMaxCallerDataDepth(), null); } catch (Error error) { error.printStackTrace(); ste = toCallerDataOld(logger); _fallbackOnOldCallerDataExtract = true; } } else { ste = toCallerDataOld(logger); } return ste; }