List of usage examples for org.apache.commons.logging Log error
void error(Object message, Throwable t);
From source file:de.xwic.appkit.core.util.StreamUtil.java
/** * @param closable//from ww w .j a v a 2 s . com * @param log */ public static void close(final Log log, final Closeable... closables) { for (final Closeable closable : closables) { if (null == closable) { continue; } try { closable.close(); } catch (final IOException e) { log.error(e.getMessage(), e); } } }
From source file:com.taobao.tddl.jdbc.group.util.ExceptionUtils.java
/** * sqlException error loglog,//from www.j a va 2 s .c om * * list * * @param logger * @param message * @param sqlExceptions */ public static void printSQLExceptionToErrorLog(Log logger, String message, List<SQLException> sqlExceptions) { if (sqlExceptions != null && !sqlExceptions.isEmpty()) { for (SQLException sqlException : sqlExceptions) { logger.error(message, sqlException); } sqlExceptions.clear(); } }
From source file:com.espertech.esper.core.ResultDeliveryStrategyImpl.java
/** * Handle the exception, displaying a nice message and converting to {@link EPException}. * @param logger is the logger to use for error logging * @param e is the exception//from w w w.java 2s. com * @param params the method parameters * @param subscriber the object to deliver to * @param method the method to call * @throws EPException converted from the passed invocation exception */ protected static void handle(String statementName, Log logger, InvocationTargetException e, Object[] params, Object subscriber, FastMethod method) { String message = JavaClassHelper.getMessageInvocationTarget(statementName, method.getJavaMethod(), subscriber.getClass().getName(), params, e); logger.error(message, e.getTargetException()); }
From source file:com.espertech.esper.core.service.ResultDeliveryStrategyImpl.java
/** * Handle the exception, displaying a nice message and converting to {@link EPException}. * @param logger is the logger to use for error logging * @param e is the exception/*w ww . j ava 2 s. c om*/ * @param parameters the method parameters * @param subscriber the object to deliver to * @param method the method to call * @throws EPException converted from the passed invocation exception */ protected static void handle(String statementName, Log logger, InvocationTargetException e, Object[] parameters, Object subscriber, FastMethod method) { String message = JavaClassHelper.getMessageInvocationTarget(statementName, method.getJavaMethod(), subscriber.getClass().getName(), parameters, e); logger.error(message, e.getTargetException()); }
From source file:net.sf.janos.util.ui.ImageUtilities.java
/** * Loads an image from the provided resource * @param resource the image to load// w w w. ja va 2 s . c o m * @return the loaded image, or null if an error occurred */ public static ImageData loadImageData(URL resource) { if (resource == null) { return null; } ImageData data = null; synchronized (IMAGE_DATA_CACHE) { try { data = IMAGE_DATA_CACHE.get(resource); return data; } catch (NoSuchKeyException e) { // fall through } } InputStream is = null; try { is = resource.openStream(); data = new ImageData(is); synchronized (IMAGE_DATA_CACHE) { IMAGE_DATA_CACHE.put(resource, data); } } catch (FileNotFoundException e) { Log log = LogFactory.getLog(ImageUtilities.class); log.debug("Image file " + resource + " does not exist"); synchronized (IMAGE_DATA_CACHE) { IMAGE_DATA_CACHE.put(resource, null); } } catch (IOException e) { Log log = LogFactory.getLog(ImageUtilities.class); log.error("Couldn't load image from " + resource, e); } finally { try { is.close(); } catch (Exception e) { } } return data; }
From source file:com.aw.core.domain.AWBusinessException.java
private static AWBusinessException wrapUnhandledException(Log logger, Throwable e, Object errorMessage) { try {/*w ww.ja v a 2 s .co m*/ AWExcepcionInterpreter excepcionInterpreter = (AWExcepcionInterpreter) ApplicationBase.instance() .getBean("exceptionInterpreter", null); if (excepcionInterpreter != null) e = excepcionInterpreter.handle(e); } catch (Throwable e2) { } if (e instanceof AWBusinessException) return (AWBusinessException) e; else { logger.error(errorMessage, e); AWBusinessException awBusinessException = new AWBusinessException( errorMessage + " : " + e.getMessage()); awBusinessException.initCause(e); return awBusinessException; } }
From source file:net.sf.nmedit.jsynth.clavia.nordmodular.utils.NmUtils.java
public static boolean writePatchSavely(NMPatch patch, File file) { try {//from ww w . j a v a 2 s .c o m writePatch(patch, file); return true; } catch (Exception e) { Log log = LogFactory.getLog(NmUtils.class); if (log.isErrorEnabled()) log.error("could not write patch " + patch + " to file " + file, e); return false; } }
From source file:com.espertech.esper.core.ResultDeliveryStrategyImpl.java
/** * Handle the exception, displaying a nice message and converting to {@link EPException}. * @param logger is the logger to use for error logging * @param t is the throwable/* www. j a v a 2 s . c o m*/ * @param params the method parameters * @param subscriber the object to deliver to * @param method the method to call * @throws EPException converted from the passed invocation exception */ protected static void handleThrowable(Log logger, Throwable t, Object[] params, Object subscriber, FastMethod method) { String message = "Unexpected exception when invoking method '" + method.getName() + "' on subscriber class '" + subscriber.getClass().getSimpleName() + "' for parameters " + ((params == null) ? "null" : Arrays.toString(params)) + " : " + t.getClass().getSimpleName() + " : " + t.getMessage(); logger.error(message, t); }
From source file:com.runwaysdk.logging.RunwayLogUtil.java
public static void logToLevel(Log log, LogLevel level, String msg, Throwable t) { if (level == LogLevel.TRACE) { log.trace(msg, t);/*ww w . j a va 2 s. com*/ } else if (level == LogLevel.DEBUG) { log.debug(msg, t); } else if (level == LogLevel.INFO) { log.info(msg, t); } else if (level == LogLevel.WARN) { log.warn(msg, t); } else if (level == LogLevel.ERROR) { log.error(msg, t); } else if (level == LogLevel.FATAL) { log.fatal(msg, t); } else { log.fatal( "RunwayLogUtil.logToLevel was called, but an invalid level was specified. Here is the message we were passed: '" + msg + "'"); } }
From source file:com.espertech.esper.core.service.ResultDeliveryStrategyImpl.java
/** * Handle the exception, displaying a nice message and converting to {@link EPException}. * @param logger is the logger to use for error logging * @param t is the throwable//from www . j av a 2s . c o m * @param parameters the method parameters * @param subscriber the object to deliver to * @param method the method to call * @throws EPException converted from the passed invocation exception */ protected static void handleThrowable(Log logger, Throwable t, Object[] parameters, Object subscriber, FastMethod method) { String message = "Unexpected exception when invoking method '" + method.getName() + "' on subscriber class '" + subscriber.getClass().getSimpleName() + "' for parameters " + ((parameters == null) ? "null" : Arrays.toString(parameters)) + " : " + t.getClass().getSimpleName() + " : " + t.getMessage(); logger.error(message, t); }