Example usage for org.apache.commons.logging Log error

List of usage examples for org.apache.commons.logging Log error

Introduction

In this page you can find the example usage for org.apache.commons.logging Log error.

Prototype

void error(Object message, Throwable t);

Source Link

Document

Logs an error with error log level.

Usage

From source file:net.sf.packtag.util.SafeLogger.java

public static void error(final Class sender, final String message, final Exception exception) {
    if (isLog4jAvailable()) {
        org.apache.log4j.Logger.getLogger(sender).error(message, exception);
    } else if (isCommonsLoggingAvailable()) {
        org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory.getLog(sender);
        log.error(message, exception);
    } else {/*  ww  w . j av a  2 s.  com*/
        System.err.println(sender.getName() + ": " + message);
        if (exception != null) {
            exception.printStackTrace();
        }
    }
}

From source file:jp.ac.u.tokyo.m.log.LogUtil.java

/**
 * Output "[aPrefix]\"[aParams[0]]\" \"[aParams[1]]\"... [aSuffix]" format log. <br>
 * "[aPrefix]\"[aParams[0]]\" \"[aParams[1]]\"... [aSuffix]" ???? <br>
 */// ww w. j  a  v a  2s  . c o  m
public static void errorMultiParam(Log aLog, String aPrefix, String aSuffix, List<? extends Object> aParams,
        Throwable aThrowable) {
    aLog.error(createMultiParamMessage(aPrefix, aSuffix, aParams), aThrowable);
}

From source file:edu.vt.middleware.ldap.ssl.SingletonTLSSocketFactory.java

/**
 * This returns the default SSL socket factory.
 *
 * @return  <code>SocketFactory</code>
 */// www  .  j a  va  2s .  c o m
public static SocketFactory getDefault() {
    final SingletonTLSSocketFactory sf = new SingletonTLSSocketFactory();
    try {
        sf.initialize();
    } catch (GeneralSecurityException e) {
        final Log logger = LogFactory.getLog(SingletonTLSSocketFactory.class);
        if (logger.isErrorEnabled()) {
            logger.error("Error initializing socket factory", e);
        }
    }
    return sf;
}

From source file:edu.vt.middleware.ldap.ssl.TLSSocketFactory.java

/**
 * This returns the default SSL socket factory.
 *
 * @return  <code>SocketFactory</code>
 *//*  w ww  . j  a v  a  2s.c  o  m*/
public static SocketFactory getDefault() {
    final TLSSocketFactory sf = new TLSSocketFactory();
    try {
        sf.initialize();
    } catch (GeneralSecurityException e) {
        final Log logger = LogFactory.getLog(TLSSocketFactory.class);
        if (logger.isErrorEnabled()) {
            logger.error("Error initializing socket factory", e);
        }
    }
    return sf;
}

From source file:com.buffalokiwi.api.APILog.java

/**
 * Log an error with error log level./*from www .  j a  va2s.c o m*/
 * 
 * @param log Log to write to
 * @param message log this message
 * @param t log this cause
 */
public static void error(final Log log, final Throwable t, final Object... message) {
    if (log.isErrorEnabled()) {
        log.error(concat(message), t);
    }
}

From source file:net.gleamynode.netty2.SessionLog.java

public static void error(Log log, Session session, Object obj, Throwable cause) {
    log.error(getMessage(session, obj), cause);
}

From source file:framework.retrieval.engine.common.RetrievalUtil.java

public static void errorLog(Log log, String msg, Throwable e) {
    if (log.isErrorEnabled()) {
        log.error(msg, e);
    }//from   w  w  w  . j a va2  s.  c  o m
}

From source file:com.alibaba.wasp.jdbc.Logger.java

/**
* Log an exception and convert it to a SQL exception if required.
*
* @param ex//from   w  ww  .ja v  a  2 s  . com
*          the exception
* @return the SQL exception object
*/
public static SQLException logAndConvert(Log log, Exception ex) {
    SQLException e = JdbcException.toSQLException(ex);
    int errorCode = e.getErrorCode();
    if (errorCode >= 23000 && errorCode < 24000) {
        log.info("exception", e);
    } else {
        log.error("exception", e);
    }
    return e;
}

From source file:de.xwic.sandbox.base.model.util.StreamUtil.java

/**
 * @param closable//  w  w w .  j  a va2s .co m
 * @param log
 */
public static void close(Log log, Closeable... closables) {
    for (Closeable closable : closables) {
        if (closable != null) {
            try {
                closable.close();
            } catch (IOException e) {
                log.error(e.getMessage(), e);
            }
        }
    }
}

From source file:com.datos.vfs.VfsLog.java

/**
 * error./*from w  ww .j a va2s  .c  o  m*/
 * @param vfslog The base component Logger to use.
 * @param commonslog The class specific Logger
 * @param message The message to log.
 * @param t The exception, if any.
 */
public static void error(final Log vfslog, final Log commonslog, final String message, final Throwable t) {
    if (vfslog != null) {
        vfslog.error(message, t);
    } else if (commonslog != null) {
        commonslog.error(message, t);
    }
}