@Override public void log(LogLevel level, String message, Throwable throwable) { Level logLevel = level == LogLevel.INFO ? Level.INFO : Level.SEVERE; logger.log(logLevel, LogLevel.LOG_PREFIX + message); if (throwable != null) { for (String line : ACFPatterns.NEWLINE.split(ApacheCommonsExceptionUtil.getFullStackTrace(throwable))) { logger.log(logLevel, LogLevel.LOG_PREFIX + line); } } }
return getCause(throwable, CAUSE_METHOD_NAMES);
/** * <p>Adds to the list of method names used in the search for <code>Throwable</code> * objects.</p> * * @param methodName the methodName to add to the list, <code>null</code> * and empty strings are ignored * @since 2.0 */ public static void addCauseMethodName(String methodName) { if (methodName != null && !methodName.isEmpty() && !isCauseMethodName(methodName)) { List list = getCauseMethodNameList(); if (list.add(methodName)) { CAUSE_METHOD_NAMES = toArray(list); } } }
/** * <p>Removes from the list of method names used in the search for <code>Throwable</code> * objects.</p> * * @param methodName the methodName to remove from the list, <code>null</code> * and empty strings are ignored * @since 2.1 */ public static void removeCauseMethodName(String methodName) { if (methodName != null && !methodName.isEmpty()) { List list = getCauseMethodNameList(); if (list.remove(methodName)) { CAUSE_METHOD_NAMES = toArray(list); } } }
return null; Throwable cause = getCauseUsingWellKnownTypes(throwable); if (cause == null) { if (methodNames == null) { String methodName = methodNames[i]; if (methodName != null) { cause = getCauseUsingMethodName(throwable, methodName); if (cause != null) { break; cause = getCauseUsingFieldName(throwable, "detail");
String stackTrace = getStackTrace(t); String linebreak = LINE_SEPARATOR; StringTokenizer frames = new StringTokenizer(stackTrace, linebreak);
@Override public void log(LogLevel level, String message, Throwable throwable) { Level logLevel = level == LogLevel.INFO ? Level.INFO : Level.SEVERE; logger.log(logLevel, LogLevel.LOG_PREFIX + message); if (throwable != null) { for (String line : ACFPatterns.NEWLINE.split(ApacheCommonsExceptionUtil.getFullStackTrace(throwable))) { logger.log(logLevel, LogLevel.LOG_PREFIX + line); } } }
/** * <p>Returns the list of <code>Throwable</code> objects in the * exception chain.</p> * * <p>A throwable without cause will return a list containing * one element - the input throwable. * A throwable with one cause will return a list containing * two elements. - the input throwable and the cause throwable. * A <code>null</code> throwable will return a list of size zero.</p> * * <p>This method handles recursive cause structures that might * otherwise cause infinite loops. The cause chain is processed until * the end is reached, or until the next item in the chain is already * in the result set.</p> * * @param throwable the throwable to inspect, may be null * @return the list of throwables, never null * @since Commons Lang 2.2 */ public static List getThrowableList(Throwable throwable) { List list = new ArrayList(); while (throwable != null && list.contains(throwable) == false) { list.add(throwable); throwable = getCause(throwable); } return list; }
@Override public void log(LogLevel level, String message, Throwable throwable) { Logger logger = this.plugin.getLogger(); Level logLevel = level == LogLevel.INFO ? Level.INFO : Level.SEVERE; logger.log(logLevel, LogLevel.LOG_PREFIX + message); if (throwable != null) { for (String line : ACFPatterns.NEWLINE.split(ApacheCommonsExceptionUtil.getFullStackTrace(throwable))) { logger.log(logLevel, LogLevel.LOG_PREFIX + line); } } }
@Override public void log(final LogLevel level, final String message, final Throwable throwable) { Logger logger = this.plugin.getLogger(); switch(level) { case INFO: logger.info(LogLevel.LOG_PREFIX + message); if (throwable != null) { for (String line : ACFPatterns.NEWLINE.split(ApacheCommonsExceptionUtil.getFullStackTrace(throwable))) { logger.info(LogLevel.LOG_PREFIX + line); } } return; case ERROR: logger.error(LogLevel.LOG_PREFIX + message); if (throwable != null) { for (String line : ACFPatterns.NEWLINE.split(ApacheCommonsExceptionUtil.getFullStackTrace(throwable))) { logger.error(LogLevel.LOG_PREFIX + line); } } } }