List of usage examples for org.apache.commons.logging Log info
void info(Object message);
From source file:com.tecapro.inventory.common.util.LogUtil.java
/** * //from ww w . j a v a 2 s . c o m * Info log output * * @param log * @param clazz * @param method * @param time */ public void infoLog(Log log, String clazz, String method, InfoValue info, Throwable e) { log.info(returnLogString(clazz, method, info, LogPrefix.OTHER, e)); if (e instanceof UniqueKeyException) { log.info(e.getMessage(), e); } }
From source file:dk.netarkivet.common.utils.cdx.ArchiveBatchJob.java
/** * Accepts only ARC and ARCGZ files. Runs through all records and calls processRecord() on every record that is * allowed by getFilter(). Does nothing on a non-arc file. * * @param arcFile The ARC or ARCGZ file to be processed. * @param os the OutputStream to which output is to be written * @return true, if file processed successful, otherwise false * @throws ArgumentNotValid if either argument is null *//*from w w w.j a v a 2 s. co m*/ public final boolean processFile(File arcFile, OutputStream os) throws ArgumentNotValid { ArgumentNotValid.checkNotNull(arcFile, "arcFile"); ArgumentNotValid.checkNotNull(os, "os"); Log log = LogFactory.getLog(getClass().getName()); long arcFileIndex = 0; boolean success = true; log.info("Processing file: " + arcFile.getName()); try { // This outer try-catch block catches all unexpected exceptions // Create an ARCReader and retrieve its Iterator: ArchiveReader arcReader = null; try { arcReader = ArchiveReaderFactory.get(arcFile); } catch (IOException e) { // Some IOException handleException(e, arcFile, arcFileIndex); return false; // Can't process file after exception } try { Iterator<? extends ArchiveRecord> it = arcReader.iterator(); /* Process all records from this Iterator: */ log.debug("Starting processing records in ARCfile '" + arcFile.getName() + "'."); if (!it.hasNext()) { log.debug("No ARCRecords found in ARCfile '" + arcFile.getName() + "'."); } while (it.hasNext()) { log.debug("At begin of processing-loop"); ArchiveRecord record = null; // Get a record from the file try { record = it.next(); } catch (Exception unexpectedException) { handleException(unexpectedException, arcFile, arcFileIndex); return false; } // Process with the job try { if (!getFilter().accept(record)) { continue; } log.debug("Processing ArchiveRecord #" + noOfRecordsProcessed + " in file '" + arcFile.getName() + "'."); processRecord(record, os); ++noOfRecordsProcessed; } catch (NetarkivetException e) { // Our exceptions don't stop us success = false; // With our exceptions, we assume that just the processing // of this record got stopped, and we can easily find the next handleOurException(e, arcFile, arcFileIndex); } catch (Exception e) { success = false; // Strange exceptions do stop us handleException(e, arcFile, arcFileIndex); // With strange exceptions, we don't know if we've skipped records break; } // Close the record try { // FIXME: Don't know how to compute this for warc-files // computation for arc-files: long arcRecordOffset = // record.getBodyOffset() + record.getMetaData().getLength(); // computation for warc-files (experimental) long arcRecordOffset = record.getHeader().getOffset(); record.close(); arcFileIndex = arcRecordOffset; } catch (IOException ioe) { // Couldn't close an ARCRecord success = false; handleException(ioe, arcFile, arcFileIndex); // If close fails, we don't know if we've skipped records break; } log.debug("At end of processing-loop"); } } finally { try { arcReader.close(); } catch (IOException e) { // Some IOException // TODO: Discuss whether exceptions on close cause filesFailed addition handleException(e, arcFile, arcFileIndex); } } } catch (Exception unexpectedException) { handleException(unexpectedException, arcFile, arcFileIndex); return false; } return success; }
From source file:com.github.baxter_rosjava_pkg.barcode_scanner.Listener.java
@Override public void onStart(ConnectedNode connectedNode) { final Log log = connectedNode.getLog(); Subscriber<sensor_msgs.Image> subscriber = connectedNode.newSubscriber("/camera/rgb/image_raw", sensor_msgs.Image._TYPE); subscriber.addMessageListener(new MessageListener<sensor_msgs.Image>() { @Override/* w ww. ja v a 2 s .co m*/ public void onNewMessage(sensor_msgs.Image message) { log.info("Recieved msg"); } }); }
From source file:com.flexive.tests.browser.AdmSelectListTest.java
/** * delete a selectList//w w w . j ava2 s . co m * @param name the name of the selectList * @param expectedResult the expected result * @param LOG the Log where to log * @return <code>expectedResult</code> if the the list could be deleted */ private boolean deleteSelectList(String name, Boolean expectedResult, Log LOG) { loadContentPage(OVERVIEW_LINK); selectFrame(Frame.Content); LOG.info("deleting : " + name); clickAndWait(getButtonFromTRContainingName_(getResultTable(null), name, ":deleteButton_"), 30000); return checkText("Successfully deleted selectlist.", expectedResult, LOG); }
From source file:com.sos.i18n.logging.commons.CommonsLogMsg.java
/** * Logs the given message to the log at the info level. If the log level is not enabled, this method does * nothing and returns <code>null</code>. If a message was logged, its {@link Msg} will be returned. * * @param log the log where the messages will go * @param key the resource bundle key name * @param varargs arguments to help fill in the resource bundle message * * @return if the message was logged, a non-<code>null</code> Msg object is returned *//*from w w w. ja v a 2s.c o m*/ public static Msg info(Log log, String key, Object... varargs) { if (log.isInfoEnabled()) { Msg msg = Msg.createMsg(key, varargs); log.info((Logger.getDumpLogKeys()) ? ('{' + key + '}' + msg) : msg); return msg; } return null; }
From source file:dk.netarkivet.common.utils.arc.ARCBatchJob.java
/** * Accepts only ARC and ARCGZ files. Runs through all records and calls * processRecord() on every record that is allowed by getFilter(). * Does nothing on a non-arc file.//from ww w. j av a 2 s. co m * * @param arcFile The ARC or ARCGZ file to be processed. * @param os the OutputStream to which output is to be written * @throws ArgumentNotValid if either argument is null * @return true, if file processed successful, otherwise false */ @Override public final boolean processFile(File arcFile, OutputStream os) throws ArgumentNotValid { ArgumentNotValid.checkNotNull(arcFile, "arcFile"); ArgumentNotValid.checkNotNull(os, "os"); Log log = LogFactory.getLog(getClass().getName()); long arcFileIndex = 0; boolean success = true; log.info("Processing ARCfile: " + arcFile.getName()); try { // This outer try-catch block catches all unexpected exceptions //Create an ARCReader and retrieve its Iterator: ARCReader arcReader = null; try { arcReader = ARCReaderFactory.get(arcFile); } catch (IOException e) { //Some IOException handleException(e, arcFile, arcFileIndex); return false; // Can't process file after exception } try { Iterator<? extends ArchiveRecord> it = arcReader.iterator(); /* Process all records from this Iterator: */ log.debug("Starting processing records in ARCfile '" + arcFile.getName() + "'."); if (!it.hasNext()) { log.debug("No ARCRecords found in ARCfile '" + arcFile.getName() + "'."); } ARCRecord record = null; while (it.hasNext()) { log.trace("At begin of processing-loop"); // Get a record from the file record = (ARCRecord) it.next(); // Process with the job try { if (!getFilter().accept(record)) { continue; } log.debug("Processing ARCRecord #" + noOfRecordsProcessed + " in ARCfile '" + arcFile.getName() + "'."); processRecord(record, os); ++noOfRecordsProcessed; } catch (NetarkivetException e) { // Our exceptions don't stop us success = false; // With our exceptions, we assume that just the // processing of this record got stopped, and we can // easily find the next handleOurException(e, arcFile, arcFileIndex); } catch (Exception e) { success = false; // Strange exceptions do stop us handleException(e, arcFile, arcFileIndex); // With strange exceptions, we don't know // if we've skipped records break; } // Close the record try { long arcRecordOffset = record.getBodyOffset() + record.getMetaData().getLength(); record.close(); arcFileIndex = arcRecordOffset; } catch (IOException ioe) { // Couldn't close an ARCRecord success = false; handleException(ioe, arcFile, arcFileIndex); // If close fails, we don't know if we've skipped // records break; } log.trace("At end of processing-loop"); } } finally { try { arcReader.close(); } catch (IOException e) { //Some IOException // TODO Discuss whether exceptions on close cause // filesFailed addition handleException(e, arcFile, arcFileIndex); } } } catch (Exception unexpectedException) { handleException(unexpectedException, arcFile, arcFileIndex); return false; } return success; }
From source file:dk.netarkivet.common.utils.warc.WARCBatchJob.java
/** * Accepts only WARC and WARCGZ files. Runs through all records and calls * processRecord() on every record that is allowed by getFilter(). * Does nothing on a non-arc file.//from w w w. jav a2 s . c o m * * @param warcFile The WARC or WARCGZ file to be processed. * @param os the OutputStream to which output is to be written * @throws ArgumentNotValid if either argument is null * @return true, if file processed successful, otherwise false */ public final boolean processFile(File warcFile, OutputStream os) throws ArgumentNotValid { ArgumentNotValid.checkNotNull(warcFile, "warcFile"); ArgumentNotValid.checkNotNull(os, "os"); Log log = LogFactory.getLog(getClass().getName()); long arcFileIndex = 0; boolean success = true; log.info("Processing WARCfile: " + warcFile.getName()); try { // This outer try-catch block catches all unexpected exceptions //Create an WARCReader and retrieve its Iterator: WARCReader warcReader = null; try { warcReader = WARCReaderFactory.get(warcFile); } catch (IOException e) { //Some IOException handleException(e, warcFile, arcFileIndex); return false; // Can't process file after exception } try { Iterator<? extends ArchiveRecord> it = warcReader.iterator(); /* Process all records from this Iterator: */ log.debug("Starting processing records in WARCfile '" + warcFile.getName() + "'."); if (!it.hasNext()) { log.debug("No WARCRecords found in WARCfile '" + warcFile.getName() + "'."); } WARCRecord record = null; while (it.hasNext()) { log.trace("At begin of processing-loop"); // Get a record from the file record = (WARCRecord) it.next(); // Process with the job try { if (!getFilter().accept(record)) { continue; } log.debug("Processing WARCRecord #" + noOfRecordsProcessed + " in WARCfile '" + warcFile.getName() + "'."); processRecord(record, os); ++noOfRecordsProcessed; } catch (NetarkivetException e) { // Our exceptions don't stop us success = false; // With our exceptions, we assume that just the // processing of this record got stopped, and we can // easily find the next handleOurException(e, warcFile, arcFileIndex); } catch (Exception e) { success = false; // Strange exceptions do stop us handleException(e, warcFile, arcFileIndex); // With strange exceptions, we don't know // if we've skipped records break; } // Close the record try { // TODO maybe this works, maybe not... long arcRecordOffset = record.getHeader().getContentBegin() + record.getHeader().getLength(); record.close(); arcFileIndex = arcRecordOffset; } catch (IOException ioe) { // Couldn't close an WARCRecord success = false; handleException(ioe, warcFile, arcFileIndex); // If close fails, we don't know if we've skipped // records break; } log.trace("At end of processing-loop"); } } finally { try { warcReader.close(); } catch (IOException e) { //Some IOException // TODO Discuss whether exceptions on close cause // filesFailed addition handleException(e, warcFile, arcFileIndex); } } } catch (Exception unexpectedException) { handleException(unexpectedException, warcFile, arcFileIndex); return false; } return success; }
From source file:com.sos.i18n.logging.commons.CommonsLogMsg.java
/** * Logs the given message to the log at the info level. If the log level is not enabled, this method does * nothing and returns <code>null</code>. If a message was logged, its {@link Msg} will be returned. * * @param log the log where the messages will go * @param locale the locale to determine what bundle to use * @param key the resource bundle key name * @param varargs arguments to help fill in the resource bundle message * * @return if the message was logged, a non-<code>null</code> Msg object is returned *///from w w w. j a v a 2 s .c om public static Msg info(Log log, Locale locale, String key, Object... varargs) { if (log.isInfoEnabled()) { Msg msg = Msg.createMsg(locale, key, varargs); log.info((Logger.getDumpLogKeys()) ? ('{' + key + '}' + msg) : msg); return msg; } return null; }
From source file:com.sos.i18n.logging.commons.CommonsLogMsg.java
/** * Logs the given message to the log at the info level. If the log level is not enabled, this method does * nothing and returns <code>null</code>. If a message was logged, its {@link Msg} will be returned. * * @param log the log where the messages will go * @param basename the base name of the resource bundle * @param key the resource bundle key name * @param varargs arguments to help fill in the resource bundle message * * @return if the message was logged, a non-<code>null</code> Msg object is returned *//*ww w . j a va2 s . co m*/ public static Msg info(Log log, BundleBaseName basename, String key, Object... varargs) { if (log.isInfoEnabled()) { Msg msg = Msg.createMsg(basename, key, varargs); log.info((Logger.getDumpLogKeys()) ? ('{' + key + '}' + msg) : msg); return msg; } return null; }
From source file:com.amazon.carbonado.repo.tupl.LogEventListener.java
@Override public void notify(EventType type, String message, Object... args) { int intLevel = type.level.intValue(); Log log = mLog; if (log != null) { if (intLevel <= Level.INFO.intValue()) { if (type.category == EventType.Category.CHECKPOINT) { if (log.isDebugEnabled()) { log.debug(format(type, message, args)); }/*from w w w .jav a 2s .c o m*/ } else if (log.isInfoEnabled()) { log.info(format(type, message, args)); } } else if (intLevel <= Level.WARNING.intValue()) { if (log.isWarnEnabled()) { log.warn(format(type, message, args)); } } else if (intLevel <= Level.SEVERE.intValue()) { if (log.isFatalEnabled()) { log.fatal(format(type, message, args)); } } } if (intLevel > Level.WARNING.intValue() && mPanicHandler != null) { mPanicHandler.onPanic(mDatabase, type, message, args); } }