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

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

Introduction

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

Prototype

void debug(Object message, Throwable t);

Source Link

Document

Logs an error with debug log level.

Usage

From source file:com.ery.ertc.estorm.util.IOUtils.java

/**
 * Close the Closeable objects and <b>ignore</b> any {@link IOException} or
 * null pointers. Must only be used for cleanup in exception handlers.
 * //from  w w  w .ja  va 2  s  .  c  om
 * @param log
 *            the log to record problems to at debug level. Can be null.
 * @param closeables
 *            the objects to close
 */
public static void cleanup(Log log, java.io.Closeable... closeables) {
    for (java.io.Closeable c : closeables) {
        if (c != null) {
            try {
                c.close();
            } catch (IOException e) {
                if (log != null && log.isDebugEnabled()) {
                    log.debug("Exception in closing " + c, e);
                }
            }
        }
    }
}

From source file:com.buaa.cfs.utils.IOUtils.java

/**
 * Close the Closeable objects and <b>ignore</b> any {@link IOException} or null pointers. Must only be used for
 * cleanup in exception handlers.// w w w.  ja v a  2s  .c  o m
 *
 * @param log        the log to record problems to at debug level. Can be null.
 * @param closeables the objects to close
 */
public static void cleanup(Log log, Closeable... closeables) {
    for (Closeable c : closeables) {
        if (c != null) {
            try {
                c.close();
            } catch (IOException e) {
                if (log != null && log.isDebugEnabled()) {
                    log.debug("Exception in closing " + c, e);
                }
            }
        }
    }
}

From source file:com.healthmarketscience.rmiio.RemoteRetry.java

/**
 * Implementation of a simple backoff strategy:
 * <ol>/*  ww w. j  a v  a  2s  .  c  om*/
 * <li>First retry returns immediately
 * <li>Retries 1 - 30 wait that many seconds each time before returning (after 1st retry wait 1 second, after 2nd retry wait 2 seconds...)
 * <li>Retries > 30 wait 30 seconds each time before returning
 * </ol>
 * 
 * @param numRetries
 *           number of retries which have happended thus far
 * @param log
 *           debug log
 */
protected static void simpleBackOff(int numRetries, Log log) {
    if (numRetries == 0) {
        // immediate retry first time
        return;
    }
    long sleepTime = numRetries;
    if (sleepTime > 30) {
        sleepTime = 30;
    }
    try {
        Thread.sleep(sleepTime * 1000);
    } catch (InterruptedException ignored) {
        // pass interrupt along
        Thread.currentThread().interrupt();
        if (log.isDebugEnabled()) {
            log.debug("Caught exception while sleeping", ignored);
        }
    }
}

From source file:dk.netarkivet.common.utils.archive.ArchiveBatchJobBase.java

/**
 * When the org.archive.io.arc classes throw IOExceptions while reading,
 * this is where they go. Subclasses are welcome to override the default
 * functionality which simply logs and records them in a list.
 * TODO: Actually use the archive file/index entries in the exception list
 *
 * @param e An Exception thrown by the org.archive.io.arc classes.
 * @param archiveFile The archive file that was processed while the Exception was thrown
 * @param index The index (in the archive file) at which the Exception was thrown
 * @throws ArgumentNotValid if e is null
 *//* ww  w .  j a v  a 2  s . c  o m*/
public void handleException(Exception e, File archiveFile, long index) throws ArgumentNotValid {
    ArgumentNotValid.checkNotNull(e, "e");

    Log log = LogFactory.getLog(getClass().getName());
    log.debug("Caught exception while running batch job " + "on file " + archiveFile + ", position " + index
            + ":\n" + e.getMessage(), e);
    addException(archiveFile, index, ExceptionOccurrence.UNKNOWN_OFFSET, e);
}

From source file:com.stimulus.archiva.exception.ChainedException.java

public ChainedException(String message, Log logger, ChainedException.Level level) {
    super(message);
    logger.debug(message, cause);
    log(level, message);/*ww w. j  ava  2  s  . c o m*/
}

From source file:net.sf.nmedit.jtheme.component.misc.CallDescriptor.java

public void call() {
    JTComponent t = getTarget();/*from ww  w .  ja v a 2s  .co  m*/
    if (t == null)
        return;
    Method m = getMethod(t);
    if (m == null)
        return;
    try {
        m.invoke(t, new Object[0]);
    } catch (Exception e) {
        Log l = LogFactory.getLog(getClass());
        if (l.isDebugEnabled())
            l.debug("call failed on method: " + method, e);
    }
}

From source file:net.sf.nmedit.jtheme.component.misc.CallDescriptor.java

private Method getMethod(JTComponent target) {
    if (tmethod == null) {
        try {//w  w w  . j  a v  a  2  s . c om
            tmethod = target.getClass().getDeclaredMethod(method, new Class[0]);
        } catch (Exception e) {
            Log l = LogFactory.getLog(getClass());
            if (l.isDebugEnabled())
                l.debug("Method not found: " + method, e);
        }
    }
    return tmethod;
}

From source file:com.stimulus.archiva.exception.ChainedException.java

public ChainedException(String message, Throwable cause, Log logger, ChainedException.Level level) {
    super(message);
    this.cause = cause;
    logger.debug(message, cause);
    log(level, message);/*from  w w  w .j  a va  2s.c  om*/
}

From source file:hadoopInstaller.logging.CompositeLog.java

@Override
public void debug(Object message, Throwable t) {
    for (Log log : this.logs) {
        log.debug(message, t);
    }/*www .  j  a v a 2s  .co  m*/
}

From source file:io.netty.logging.CommonsLoggerTest.java

@Test
public void testDebugWithException() {
    Log mock = createStrictMock(Log.class);

    mock.debug("a", e);
    replay(mock);/*from www  . j av  a 2s.  c  o m*/

    InternalLogger logger = new CommonsLogger(mock, "foo");
    logger.debug("a", e);
    verify(mock);
}