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

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

Introduction

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

Prototype

void info(Object message);

Source Link

Document

Logs a message with info log level.

Usage

From source file:net.mikaboshi.intra_mart.tools.log_stats.parser.LineLogParser.java

/**
 * INFO??/*from  w w w .  j a v  a 2  s  . c o  m*/
 */
@Override
protected void info(String format, Object... args) {

    Log logger = getLogger();

    if (logger.isInfoEnabled()) {
        logger.info(String.format("[" + getLogFilePath() + "#" + this.nLine + "] " + format, args));
    }
}

From source file:com.github.iai_swm.Listener.java

@Override
public void onStart(ConnectedNode connectedNode) {
    final Log log = connectedNode.getLog();
    Subscriber<std_msgs.String> subscriber = connectedNode.newSubscriber("chatter", std_msgs.String._TYPE);
    subscriber.addMessageListener(new MessageListener<std_msgs.String>() {
        @Override/*  w  ww . jav a 2s  .co m*/
        public void onNewMessage(std_msgs.String message) {
            log.info("I heard: \"" + message.getData() + "\"");
        }
    });
}

From source file:com.github.rosjava_catkin_package_a.my_pub_sub_tutorial.Listener.java

@Override
public void onStart(ConnectedNode connectedNode) {
    final Log log = connectedNode.getLog();
    Subscriber<std_msgs.String> subscriber = connectedNode.newSubscriber("chatter", std_msgs.String._TYPE);
    subscriber.addMessageListener(new MessageListener<std_msgs.String>() {
        @Override/*ww w . ja v a  2s  .c o  m*/
        public void onNewMessage(std_msgs.String message) {
            log.info("Teste esta funcionando: \"" + message.getData() + "\"");
        }
    });
}

From source file:com.CodeSeance.JSeance2.CodeGenXML.Runtime.java

private String run(File templateFile, File includesDir, File modelsDir, File targetDir,
        TemplateDependencies templateDependencies) {
    // Create a local logger for the static context
    Log log = com.CodeSeance.JSeance2.CodeGenXML.Runtime.CreateLogger(Runtime.class);
    if (log.isInfoEnabled()) {
        log.info(String.format("Loading Template:[%s]", templateFile.toString()));
    }//  w  w w . ja v a  2s .c  o  m

    Template template;
    try {
        template = new Template(templateFile);
        template.loadChildren(template, null);
    } catch (IOException ex) {
        throw new RuntimeException(ExecutionError.INVALID_TEMPLATE_FILE.getMessage(templateFile.toString()),
                ex);
    }

    if (log.isInfoEnabled()) {
        log.info("Template validated");
    }

    // Create a new Context
    Context context = new Context(includesDir, modelsDir, targetDir, ignoreReadOnlyOuputFiles,
            templateDependencies);

    try {
        // Enter and leave the context on the new template element
        template.loadAttributes(context);
        template.onExecutionStart(context);
        template.onExecutionEnd(context);
    } finally {
        // dispose the context manager to release used resources
        context.dispose();
    }

    return template.getText();
}

From source file:com.CodeSeance.JSeance2.CodeGenXML.Context.java

public void LogInfoMessage(Log log, String tagName, String message) {
    if (log.isInfoEnabled()) {
        log.info(String.format("<%s> - %s", tagName, message));
    }//ww  w  .j  a va  2  s .co m
}

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

/**
 * Accepts only arc(.gz) and warc(.gz) files. Runs through all records and calls
 * processRecord() on every record that is allowed by getFilter().
 * Does nothing on a non-(w)arc file./* w w w . j  a  va2s. com*/
 *
 * @param archiveFile The arc(.gz) or warc(.gz) 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 archiveFile, OutputStream os) throws ArgumentNotValid {
    ArgumentNotValid.checkNotNull(archiveFile, "archiveFile");
    ArgumentNotValid.checkNotNull(os, "os");
    Log log = LogFactory.getLog(getClass().getName());
    long arcFileIndex = 0;
    boolean success = true;
    log.info("Processing archive file: " + archiveFile.getName());

    try { // This outer try-catch block catches all unexpected exceptions
          //Create an ArchiveReader and retrieve its Iterator:
        ArchiveReader archiveReader = null;

        try {
            archiveReader = ArchiveReaderFactory.get(archiveFile);
        } catch (IOException e) { //Some IOException
            handleException(e, archiveFile, arcFileIndex);

            return false; // Can't process file after exception
        }

        try {
            Iterator<? extends ArchiveRecord> it = archiveReader.iterator();
            /* Process all records from this Iterator: */
            log.debug("Starting processing records in archive file '" + archiveFile.getName() + "'.");
            if (!it.hasNext()) {
                log.debug("No records found in archive file '" + archiveFile.getName() + "'.");
            }
            ArchiveRecord archiveRecord = null;
            ArchiveRecordBase record;
            while (it.hasNext()) {
                log.trace("At begin of processing-loop");
                // Get a record from the file
                archiveRecord = (ArchiveRecord) it.next();
                record = ArchiveRecordBase.wrapArchiveRecord(archiveRecord);
                // Process with the job
                try {
                    if (!getFilter().accept(record)) {
                        continue;
                    }
                    log.debug("Processing record #" + noOfRecordsProcessed + " in archive file '"
                            + archiveFile.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, archiveFile, arcFileIndex);
                } catch (Exception e) {
                    success = false; // Strange exceptions do stop us

                    handleException(e, archiveFile, 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();
                     */
                    // TODO maybe this works, maybe not...
                    long arcRecordOffset = archiveRecord.getHeader().getContentBegin()
                            + archiveRecord.getHeader().getLength();
                    archiveRecord.close();
                    arcFileIndex = arcRecordOffset;
                } catch (IOException ioe) { // Couldn't close an WARCRecord
                    success = false;

                    handleException(ioe, archiveFile, arcFileIndex);
                    // If close fails, we don't know if we've skipped
                    // records
                    break;
                }
                log.trace("At end of processing-loop");
            }
        } finally {
            try {
                archiveReader.close();
            } catch (IOException e) { //Some IOException
                // TODO Discuss whether exceptions on close cause
                // filesFailed addition
                handleException(e, archiveFile, arcFileIndex);
            }
        }
    } catch (Exception unexpectedException) {
        handleException(unexpectedException, archiveFile, arcFileIndex);
        return false;
    }
    return success;
}

From source file:com.amazon.carbonado.spi.AbstractRepository.java

void info(String message) {
    Log log = getLog();
    if (log != null) {
        log.info(message);
    }
}

From source file:io.smartspaces.liveactivity.runtime.configuration.BasePropertyFileLiveActivityConfigurationManager.java

@Override
public StandardLiveActivityConfiguration newLiveActivityConfiguration(InstalledLiveActivity liveActivity,
        InternalLiveActivityFilesystem activityFilesystem) {
    ExpressionEvaluator expressionEvaluator = expressionEvaluatorFactory.newEvaluator();

    File baseActivityConfiguration = getBaseActivityConfiguration(liveActivity, activityFilesystem);
    SingleConfigurationStorageManager baseConfigurationStorageManager = newConfiguration(
            baseActivityConfiguration, true, expressionEvaluator);

    File installedActivityConfiguration = getInstalledActivityConfiguration(liveActivity, activityFilesystem);
    boolean configurationFileRequired = isInstalledActivityConfigurationFileRequired();
    SingleConfigurationStorageManager installedActivityConfigurationStorageManager = newConfiguration(
            installedActivityConfiguration, configurationFileRequired, expressionEvaluator);

    Log log = spaceEnvironment.getLog();
    boolean fileExists = installedActivityConfiguration.exists();
    String absolutePath = installedActivityConfiguration.getAbsolutePath();
    if (fileExists) {
        log.info("Using installed activity configuration file " + absolutePath);
    } else if (configurationFileRequired) {
        log.error("Missing required installed activity configuration file " + absolutePath);
    } else {// w  w w  . jav  a2  s  .co  m
        log.warn("Skipping missing installed activity configuration file " + absolutePath);
    }

    StandardLiveActivityConfiguration configuration = new StandardLiveActivityConfiguration(
            baseConfigurationStorageManager, installedActivityConfigurationStorageManager, expressionEvaluator,
            spaceEnvironment.getSystemConfiguration());
    // TODO(keith): Given where we are, should the symbol tables be cleared?
    expressionEvaluator.getEvaluationEnvironment().addSymbolTableFront(configuration.asSymbolTable());

    return configuration;
}

From source file:com.chinamobile.bcbsp.comm.io.util.MemoryAllocator.java

/**
 * Set up the graph data load buffer size.
 * Make sure that hash number is initialized.
 *//* ww  w  .  j  a  v a2 s. com*/
public void setupBeforeLoadGraph(Log LOG) {
    long byteSizeForGraphLoad = remainAdjusted / MetaDataOfGraph.BCBSP_DISKGRAPH_HASHNUMBER;
    MetaDataOfGraph.BCBSP_GRAPH_LOAD_INIT = (int) (byteSizeForGraphLoad
            / MetaDataOfGraph.BCBSP_DISKGRAPH_HASHNUMBER / 2);
    LOG.info("Graph Load Buffer Size **************** " + MetaDataOfGraph.BCBSP_GRAPH_LOAD_INIT);
}

From source file:com.tecapro.inventory.common.util.LogUtil.java

/**
 * //from   w  w w  .  ja  v a2s.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, String message) {
    log.info(returnLogString(clazz, method, info, LogPrefix.OTHER, message));
}