List of usage examples for org.apache.commons.logging Log debug
void debug(Object message, Throwable t);
From source file:fr.gouv.vitam.utils.logging.CommonsLoggerTest.java
@Test public void testDebugWithException() { final Log mock = createStrictMock(Log.class); mock.debug("a", e); replay(mock);/* w ww. ja v a2 s . c o m*/ final VitamLogger logger = new CommonsLogger(mock, "foo"); logger.debug("a", e); verify(mock); }
From source file:dk.netarkivet.common.utils.cdx.ArchiveBatchJob.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 arcfile/index entries in the exception list * * @param e An Exception thrown by the org.archive.io.arc classes. * @param arcfile The arcFile that was processed while the Exception was thrown * @param index The index (in the ARC file) at which the Exception was thrown * @throws ArgumentNotValid if e is null *///from w w w . jav a2s. c om public void handleException(Exception e, File arcfile, long index) throws ArgumentNotValid { ArgumentNotValid.checkNotNull(e, "e"); Log log = LogFactory.getLog(getClass().getName()); log.debug("Caught exception while running batch job " + "on file " + arcfile + ", position " + index + ":\n" + e.getMessage(), e); addException(arcfile, index, ExceptionOccurrence.UNKNOWN_OFFSET, e); }
From source file:dk.netarkivet.common.utils.warc.WARCBatchJob.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 warcfile/index entries in the exception list * * @param e An Exception thrown by the org.archive.io.arc classes. * @param warcfile The arcFile that was processed while the Exception * was thrown//from w ww .j a v a 2 s. c o m * @param index The index (in the WARC file) at which the Exception * was thrown * @throws ArgumentNotValid if e is null */ public void handleException(Exception e, File warcfile, long index) throws ArgumentNotValid { ArgumentNotValid.checkNotNull(e, "e"); Log log = LogFactory.getLog(getClass().getName()); log.debug("Caught exception while running batch job " + "on file " + warcfile + ", position " + index + ":\n" + e.getMessage(), e); addException(warcfile, index, ExceptionOccurrence.UNKNOWN_OFFSET, e); }
From source file:dk.netarkivet.common.utils.arc.ARCBatchJob.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 arcfile/index entries in the exception list * * @param e An Exception thrown by the org.archive.io.arc classes. * @param arcfile The arcFile that was processed while the Exception * was thrown/*from w w w . ja v a 2s.c o m*/ * @param index The index (in the ARC file) at which the Exception * was thrown * @throws ArgumentNotValid if e is null */ public void handleException(Exception e, File arcfile, long index) throws ArgumentNotValid { ArgumentNotValid.checkNotNull(e, "e"); Log log = LogFactory.getLog(getClass().getName()); log.debug("Caught exception while running batch job " + "on file " + arcfile + ", position " + index + ":\n" + e.getMessage(), e); addException(arcfile, index, ExceptionOccurrence.UNKNOWN_OFFSET, e); }
From source file:com.runwaysdk.format.ParseException.java
/** * Logs an exception when a parse error occurs. Because parse errors * are a normal part of handling user input, this will only log at the * DEBUG level to avoid flooding the logs. */// ww w . j a va2s . com @Override protected void logException() { Log log = this.getLog(); if (log.isDebugEnabled()) { String template = "Error in [%s] when parsing [%s] with locale [%s]."; String message = String.format(template, this.getFormat(), this.getValue(), this.getLocale()); log.debug(message, this); } }
From source file:com.runwaysdk.format.FormatException.java
/** * Logs an exception when a format error occurs. Because format errors * are a normal part of handling user input, this will only log at the * DEBUG level to avoid flooding the logs. *///from w w w . j av a2 s. c om @Override protected void logException() { Log log = this.getLog(); if (log.isDebugEnabled()) { String template = "Error in [%s] when formatting [%s] with locale [%s]."; String message = String.format(template, this.getFormat(), this.getObject(), this.getLocale()); log.debug(message, this); } }
From source file:com.runwaysdk.format.DisplayException.java
/** * Logs an exception when a display error occurs. Because display errors * are a normal part of handling user input, this will only log at the * DEBUG level to avoid flooding the logs. */// ww w . ja va 2s . co m @Override protected void logException() { Log log = this.getLog(); if (log.isDebugEnabled()) { String template = "Error in [%s] when displaying [%s] with locale [%s]."; String message = String.format(template, this.getFormat(), this.getObject(), this.getLocale()); log.debug(message, this); } }
From source file:com.sos.i18n.logging.commons.CommonsLogMsg.java
/** * Logs the message, along with the given <code>throwable</code>, at the debug level. If * {@link Logger#getDumpStackTraces() stack traces are not to be dumped}, the logged message will be appended * with the throwable's <code>Throwable.toString()</code> contents. * * @param log where to log the message * @param key the resource key that is associated with the message * @param msg the message to log//from ww w . j a va 2s . com * @param throwable the throwable associated with the message */ private static void logDebugWithThrowable(Log log, String key, Msg msg, Throwable throwable) { if (Logger.getDumpStackTraces()) { log.debug(((Logger.getDumpLogKeys()) ? ('{' + key + '}' + msg) : msg), throwable); } else { log.debug(((Logger.getDumpLogKeys()) ? ('{' + key + '}' + msg) : msg) + ". Cause: " + throwable.toString()); } }
From source file:net.sourceforge.eclipsetrader.core.internal.LogListener.java
public void logging(IStatus status, String plugin) { Log log = LogFactory.getLog(plugin); switch (status.getSeverity()) { case IStatus.INFO: log.info(status.getMessage(), status.getException()); break;/*from ww w . j av a 2s. c o m*/ case IStatus.WARNING: log.warn(status.getMessage(), status.getException()); break; case IStatus.ERROR: log.error(status.getMessage(), status.getException()); break; default: log.debug(status.getMessage(), status.getException()); break; } }
From source file:net.sf.nmedit.nordmodular.Installer.java
private void loadSessionFromProperties(TempDir tmpDir, Properties props) { String PCountString = props.getProperty(SESSION_PATCHCOUNT); if (PCountString == null) return;/*from w ww . j a v a2 s . c o m*/ int patchcount; try { patchcount = Integer.parseInt(PCountString); } catch (NumberFormatException e) { Log log = LogFactory.getLog(getClass()); if (log.isDebugEnabled()) { log.debug("exception while loading session file", e); } return; } for (int i = 0; i < patchcount; i++) { File sourceFile = null; String keySourceFile = getSourceFileKey(i); String sourceFileString = props.getProperty(keySourceFile); if (sourceFileString != null) sourceFile = new File(sourceFileString); File tmpFile = getPatchTmpFile(tmpDir, i); String title = props.getProperty(getTitleKey(i)); NMPatch patch = tryOpenSessionPatch(tmpFile, sourceFile, title); } }