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:org.displaytag.exception.BaseNestableJspTagException.java

/**
 * Instantiate a new BaseNestableJspTagException.
 * @param source Class where the exception is generated
 * @param message message//from w  w w .  j  a v a2 s.c o  m
 */
public BaseNestableJspTagException(Class source, String message) {
    super(message);
    this.sourceClass = source;

    // log exception
    Log log = LogFactory.getLog(source);

    // choose appropriate logging method
    if (getSeverity() == SeverityEnum.DEBUG) {
        log.debug(toString());
    } else if (getSeverity() == SeverityEnum.INFO) {
        log.info(toString());
    } else if (getSeverity() == SeverityEnum.WARN) {
        log.warn(toString());
    } else {
        // error - default
        log.error(toString());
    }

}

From source file:org.displaytag.exception.BaseNestableRuntimeException.java

/**
 * Instantiate a new BaseNestableRuntimeException.
 * @param source Class where the exception is generated
 * @param message message/*w  w w . j  a va 2s .c  o m*/
 */
public BaseNestableRuntimeException(Class source, String message) {
    super(message);
    this.sourceClass = source;

    // log exception
    Log log = LogFactory.getLog(source);

    // choose appropriate logging method
    if (getSeverity() == SeverityEnum.DEBUG) {
        log.debug(toString());
    } else if (getSeverity() == SeverityEnum.INFO) {
        log.info(toString());
    } else if (getSeverity() == SeverityEnum.WARN) {
        log.warn(toString());
    } else {
        // error - default
        log.error(toString());
    }

}

From source file:org.easyrec.utils.io.autoimport.AutoImportUtils.java

public static void logSkippedLine(Log logger, int lineCounter, String line, String message) {
    if (logger.isInfoEnabled()) {
        StringBuilder s = new StringBuilder("skipped data line[");
        s.append(lineCounter);//from  w  ww  . j a  v a 2s . c o m
        s.append("] '");
        s.append(line);
        s.append("', ");
        s.append(message);
        logger.info(s.toString());
    }
}

From source file:org.easyrec.utils.spring.log.LoggerUtils.java

/**
 * Writes the given 'message' to the Log 'logger' with level 'logLevel'.
 *
 * @param logger   the Log to which the message is written
 * @param logLevel the level to which the message is written
 * @param message  the message to be written
 *///from  ww  w  . j  a v a2 s . c o  m
public static void log(Log logger, String logLevel, String message) {
    if (logLevel.equalsIgnoreCase("info")) {
        if (logger.isInfoEnabled()) {
            logger.info(message);
        }
    } else if (logLevel.equalsIgnoreCase("debug")) {
        if (logger.isDebugEnabled()) {
            logger.debug(message);
        }
    } else if (logLevel.equalsIgnoreCase("error")) {
        if (logger.isErrorEnabled()) {
            logger.error(message);
        }
    } else if (logLevel.equalsIgnoreCase("trace")) {
        if (logger.isTraceEnabled()) {
            logger.trace(message);
        }
    } else if (logLevel.equalsIgnoreCase("warn")) {
        if (logger.isWarnEnabled()) {
            logger.warn(message);
        }
    } else if (logLevel.equalsIgnoreCase("fatal")) {
        if (logger.isFatalEnabled()) {
            logger.fatal(message);
        }
    } else {
        logger.error("Passed unknown log level " + logLevel + " to Aspect - logging to error instead!");
        logger.error(message);
    }
}

From source file:org.eclipse.emf.mwe.core.WorkflowEngine.java

private void logIssues(final Log logger, final Issues issues) {
    // log any configuration warning messages
    final Diagnostic[] issueArray = issues.getIssues();
    for (final Diagnostic issue : issueArray) {
        if (issue.getSeverity() == Diagnostic.ERROR) {
            logger.error(issue.toString());
        }//from   www .  j  a va  2s .c  om
        if (issue.getSeverity() == Diagnostic.WARNING) {
            logger.warn(issue.toString());
        }
        if (issue.getSeverity() == Diagnostic.INFO) {
            logger.info(issue.toString());
        }
    }
}

From source file:org.eclipse.smila.binarystorage.persistence.BinaryPersistenceFactory.java

/**
 * Creates concrete BinaryPersistence implementation.
 * //from w ww. j a v a2  s.c om
 * @param configuration
 * @return BinaryPersistence
 * @throws BinaryStorageException -
 *           in case BinaryPersistence implementation is not configured
 */
@SuppressWarnings("unchecked")
public static BinaryPersistence newImplInstance(BinaryStorageConfiguration configuration)
        throws BinaryStorageException {
    try {
        final Class clazz = Class.forName(configuration.getImplementationClass());
        final Constructor implConstructor = clazz
                .getConstructor(new Class[] { BinaryStorageConfiguration.class });

        return (BinaryPersistence) implConstructor.newInstance(new Object[] { configuration });
    } catch (final Exception exception) {
        throw new IllegalArgumentException("Invalid BinaryPersistence configuration", exception);
    } finally {
        final Log log = LogFactory.getLog(BinaryPersistenceFactory.class);
        if (log.isInfoEnabled()) {
            log.info("Created new BinaryPersistence implementation instance :"
                    + configuration.getImplementationClass());
        }
    }
}

From source file:org.eclipse.smila.management.jmx.client.helpers.OutWriter.java

/**
 * Write./*from w w w . ja v a  2 s  .com*/
 * 
 * @param echo
 *          the echo
 * @param log
 *          the log
 */
public static void write(final String echo, final Log log) {
    log.info(echo);
}

From source file:org.eclipse.smila.management.jmx.client.helpers.OutWriter.java

/**
 * Write item list.// www  .j  a va  2 s  .c om
 * 
 * @param n
 *          the n
 * @param o
 *          the o
 * @param log
 *          the log
 */
private static void writeItemList(final int n, final Object o, final Log log) {
    log.info(String.format("%d. %s", n, o));
}

From source file:org.eclipse.smila.management.jmx.client.helpers.OutWriter.java

/**
 * Write line./*from w  w  w .  j  a  v a2s.c  om*/
 * 
 * @param o
 *          the o
 * @param log
 *          the log
 */
private static void writeLine(final Object o, final Log log) {
    log.info(o);
}

From source file:org.eclipse.smila.search.index.IndexConnection.java

/**
 * Performs a search for a fully complex query expression.
 * // w  w  w.j  av a  2s  .c  o m
 * @param dQuery
 *          -
 * @return LuceneSearchResult
 * @throws IndexException
 *           -
 */
public LuceneSearchResult doQuery(final DQuery dQuery) throws IndexException {
    final Log log = LogFactory.getLog(getClass());

    validateQuery(dQuery);

    try {
        final DTemplate dTemplate = TemplateRegistryController.getTemplate(dQuery);
        IQueryExpression dQE = null;
        if (dTemplate != null) {
            if (log.isInfoEnabled()) {
                log.info("using template [" + dQuery.getIndexName() + ";" + dTemplate.getName() + "]");
            }
            dQE = TemplateRegistryController.applyTemplate(dQuery, dTemplate, this);
        } else {
            // transform
            dQE = getSimpleSearchQuery(dQuery);
        }

        final LuceneSearchResult searchResult = doQuery(dQE,
                (dQuery.getStartHits() != null ? dQuery.getStartHits().intValue() : 0));

        // add result attributes
        if (dQuery.getResultFields() != null) {
            addResultAttributes(dQuery.getResultFields(), searchResult);
        }

        // add highlight attributes
        if (dQuery.getHighlightFields() != null) {
            addHighlightResultAttributes(dQuery.getHighlightFields(), searchResult, dQE);
        }

        return searchResult;
    } catch (final TemplateException e) {
        log.error("error while NQE transformation", e);
        throw new IndexException("unable to apply templates", e);
    } catch (final NodeTransformerException e) {
        log.error("unable to perform node transformation", e);
        throw new IndexException("unable to perform node transformation", e);
    }
}