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.openhft.chronicle.logger.jcl.JclTestBase.java

protected static void log(Log logger, ChronicleLogLevel level, String message) {
    switch (level) {
    case TRACE:/*from w w w  .j  ava  2s .c om*/
        logger.trace(message);
        break;
    case DEBUG:
        logger.debug(message);
        break;
    case INFO:
        logger.info(message);
        break;
    case WARN:
        logger.warn(message);
        break;
    case ERROR:
        logger.error(message);
        break;
    default:
        throw new UnsupportedOperationException();
    }
}

From source file:com.acciente.induction.init.ControllerResolverInitializer.java

public static ControllerResolver getControllerResolver(Config.ControllerResolver oControllerResolverConfig,
        Config.ControllerMapping oControllerMappingConfig, ModelPool oModelPool, ClassLoader oClassLoader,
        ServletConfig oServletConfig)//  w w w  .ja va 2s .c  o m
        throws ClassNotFoundException, InvocationTargetException, ConstructorNotFoundException,
        ParameterProviderException, IllegalAccessException, InstantiationException, IOException {
    ControllerResolver oControllerResolver;
    String sControllerResolverClassName;
    Log oLog;

    oLog = LogFactory.getLog(ControllerResolverInitializer.class);

    sControllerResolverClassName = oControllerResolverConfig.getClassName();

    if (Strings.isEmpty(sControllerResolverClassName)) {
        oControllerResolver = new ShortURLControllerResolver(oControllerMappingConfig, oClassLoader);
    } else {
        oLog.info("loading user-defined controller resolver: " + sControllerResolverClassName);

        Class oControllerResolverClass = oClassLoader.loadClass(sControllerResolverClassName);

        // attempt to find and call the single public constructor
        oControllerResolver = (ControllerResolver) ObjectFactory.createObject(oControllerResolverClass,
                new Object[] { oServletConfig, oControllerResolverConfig, oControllerMappingConfig,
                        oClassLoader },
                new InitializerParameterProvider(oModelPool, "controller-resolver-init"));
    }

    return oControllerResolver;
}

From source file:com.runwaysdk.logging.RunwayLogUtil.java

public static void logToLevel(Log log, LogLevel level, String msg) {
    if (level == LogLevel.TRACE) {
        log.trace(msg);//from   w  ww  . ja  v  a  2  s  .  co m
    } else if (level == LogLevel.DEBUG) {
        log.debug(msg);
    } else if (level == LogLevel.INFO) {
        log.info(msg);
    } else if (level == LogLevel.WARN) {
        log.warn(msg);
    } else if (level == LogLevel.ERROR) {
        log.error(msg);
    } else if (level == LogLevel.FATAL) {
        log.fatal(msg);
    } else {
        log.fatal(
                "RunwayLogUtil.logToLevel was called, but an invalid level was specified. Here is the message we were passed: '"
                        + msg + "'");
    }
}

From source file:net.sourceforge.dita4publishers.impl.ditabos.DitaBosHelper.java

/**
 * Constructs a full DITA BOS from the specified root map using the specified BOS construction options.
 * @param bosOptions//from   w  w  w . ja v a  2  s  .co  m
 * @param log 
 * @param rootMap
 * @return
 * @throws Exception 
 */
public static DitaBoundedObjectSet calculateMapBos(BosConstructionOptions bosOptions, Log log, Document rootMap)
        throws Exception {

    Map<URI, Document> domCache = bosOptions.getDomCache();

    if (domCache == null) {
        domCache = new HashMap<URI, Document>();
        bosOptions.setDomCache(domCache);
    }

    DitaBoundedObjectSet bos = new DitaBoundedObjectSetImpl(bosOptions);

    if (!bosOptions.isQuiet())
        log.info("calculateMapBos(): Starting map BOS calculation...");

    Element elem = rootMap.getDocumentElement();
    if (!DitaUtil.isDitaMap(elem) && !DitaUtil.isDitaTopic(elem)) {
        throw new DitaBosHelperException(
                "Input root map " + rootMap.getDocumentURI() + " does not appear to be a DITA map or topic.");
    }

    DitaKeySpace keySpace;
    try {
        DitaKeyDefinitionContext keyDefContext = new KeyDefinitionContextImpl(rootMap);
        keySpace = new InMemoryDitaKeySpace(keyDefContext, rootMap, bosOptions);
    } catch (DitaApiException e) {
        throw new BosException("DITA API Exception: " + e.getMessage(), e);
    }

    DitaTreeWalker walker = new DitaDomTreeWalker(log, keySpace, bosOptions);
    walker.setRootObject(rootMap);
    walker.walk(bos);

    if (!bosOptions.isQuiet())
        log.info("calculateMapBos(): Returning BOS. BOS has " + bos.size() + " members.");
    return bos;
}

From source file:com.espertech.esper.epl.lookup.SubordinateQueryPlannerUtil.java

public static void queryPlanLogOnExpr(boolean queryPlanLogging, Log queryPlanLog,
        SubordinateWMatchExprQueryPlanResult strategy, Annotation[] annotations) {
    QueryPlanIndexHook hook = QueryPlanIndexHookUtil.getHook(annotations);
    if (queryPlanLogging && (queryPlanLog.isInfoEnabled() || hook != null)) {
        String prefix = "On-Expr ";
        queryPlanLog.info(prefix + "strategy " + strategy.getFactory().toQueryPlan());
        if (strategy.getIndexDescs() == null) {
            queryPlanLog.info(prefix + "full table scan");
        } else {//from   ww  w.  jav a 2s.co m
            for (int i = 0; i < strategy.getIndexDescs().length; i++) {
                String indexName = strategy.getIndexDescs()[i].getIndexName();
                String indexText = indexName != null ? "index " + indexName + " " : "(implicit) (" + i + ")";
                queryPlanLog.info(prefix + indexText);
            }
        }
        if (hook != null) {
            IndexNameAndDescPair[] pairs = getPairs(strategy.getIndexDescs());
            SubordTableLookupStrategyFactory inner = strategy.getFactory().getOptionalInnerStrategy();
            hook.infraOnExpr(
                    new QueryPlanIndexDescOnExpr(pairs, strategy.getFactory().getClass().getSimpleName(),
                            inner == null ? null : inner.getClass().getSimpleName()));
        }
    }
}

From source file:com.acciente.induction.init.TemplatingEngineInitializer.java

public static TemplatingEngine getTemplatingEngine(Config.Templating oTemplatingConfig, ModelPool oModelPool,
        ClassLoader oClassLoader, ServletConfig oServletConfig)
        throws ClassNotFoundException, IOException, InvocationTargetException, ConstructorNotFoundException,
        ParameterProviderException, IllegalAccessException, InstantiationException {
    TemplatingEngine oTemplatingEngine;/* ww w  .  j a v  a  2s. c  o  m*/
    String sTemplatingEngineClassName;
    Log oLog;

    oLog = LogFactory.getLog(TemplatingEngineInitializer.class);

    sTemplatingEngineClassName = oTemplatingConfig.getTemplatingEngine().getClassName();

    if (Strings.isEmpty(sTemplatingEngineClassName)) {
        // if no templating engine is configured use the freemarker engine as the default
        oTemplatingEngine = new FreemarkerTemplatingEngine(oTemplatingConfig, oClassLoader, oServletConfig);
    } else {
        oLog.info("loading user-defined templating engine: " + sTemplatingEngineClassName);

        Class oTemplatingEngineClass = oClassLoader
                .loadClass(oTemplatingConfig.getTemplatingEngine().getClassName());

        oTemplatingEngine = (TemplatingEngine) ObjectFactory.createObject(oTemplatingEngineClass,
                new Object[] { oServletConfig, oTemplatingConfig, oClassLoader },
                new InitializerParameterProvider(oModelPool, "templating-engine-init"));
    }

    return oTemplatingEngine;
}

From source file:net.sf.ufsc.ServiceLoader.java

/**
 * Creates a new service loader for the given service type, using the
 * current thread's {@linkplain java.lang.Thread#getContextClassLoader
 * context class loader}./*from  w  w  w. ja  va2s  .  c  o  m*/
 *
 * <p> An invocation of this convenience method of the form
 *
 * <blockquote><pre>
 * ServiceLoader.load(<i>service</i>)</pre></blockquote>
 *
 * is equivalent to
 *
 * <blockquote><pre>
 * ServiceLoader.load(<i>service</i>,
 *                    Thread.currentThread().getContextClassLoader())</pre></blockquote>
 *
 * @param  service
 *         The interface or abstract class representing the service
 *
 * @return A new service loader
 */
public static <S> ServiceLoader<S> load(Class<S> service) {
    ClassLoader cl = Thread.currentThread().getContextClassLoader();
    Log log = LogFactory.getLog(service.getClass());
    log.info("Loading ufsc service for " + service.getName());
    return ServiceLoader.load(service, cl);
}

From source file:net.sf.nmedit.nomad.core.jpf.JPFServiceInstallerTool.java

private static void activateService(Log log, Map<String, Class<Service>> serviceClassCache, Extension extension,
        ClassLoader pluginClassLoader) {
    String serviceClassName = extension.getParameter(SERVICE_CLASS_KEY).valueAsString();

    String implementationClassName = extension.getParameter(SERVICE_IMPLEMENTATION_CLASS_KEY).valueAsString();

    if (log.isInfoEnabled()) {
        String description = extension.getParameter(SERVICE_DESCRIPTION_KEY).valueAsString();

        log.info("Service implementation / Service: " + implementationClassName + " (description=" + description
                + ") / " + serviceClassName);
    }/*  w w  w. j  av a  2  s. co m*/

    Class<Service> serviceClass;
    try {
        serviceClass = lookupServiceClass(serviceClassCache, serviceClassName, pluginClassLoader);
    } catch (ClassNotFoundException e) {
        if (log.isWarnEnabled()) {
            log.warn("Error loading service class: " + serviceClassName, e);
        }

        return;
    }

    Class<Service> serviceImplementationClass;
    try {
        serviceImplementationClass = lookupServiceImplementationClass(serviceClass, implementationClassName,
                pluginClassLoader);
    } catch (ClassNotFoundException e) {
        if (log.isWarnEnabled()) {
            log.warn("Error loading service implementation class: " + implementationClassName, e);
        }
        return;
    }

    Service serviceInstance;
    try {
        serviceInstance = serviceImplementationClass.newInstance();
    } catch (InstantiationException e) {
        if (log.isWarnEnabled()) {
            log.warn("Error instantiating service: " + serviceImplementationClass, e);
        }

        return;
    } catch (IllegalAccessException e) {
        if (log.isWarnEnabled()) {
            log.warn("Error instantiating service: " + serviceImplementationClass, e);
        }

        return;
    }

    try {
        ServiceRegistry.addService(serviceClass, serviceInstance);
    } catch (ServiceException e) {
        if (log.isWarnEnabled()) {
            log.warn("Error installing service: " + serviceInstance, e);
        }

        return;
    }
}

From source file:com.bt.aloha.batchtest.WeekendBatchTest.java

protected static void logStatistics(Log alog, BatchTest batchTest) {
    int dialogInvocationCount = batchTest.getDialogCollection().getInvocationCounterSize();
    int callInvocationCount = batchTest.getCallCollection().getInvocationCounterSize();
    int conferenceInvocationCount = batchTest.getConferenceCollection().getInvocationCounterSize();
    int dialogExceptionsCount = batchTest.getDialogCollection().getExceptionCounterSize();
    int callExceptionsCount = batchTest.getCallCollection().getExceptionCounterSize();
    int conferenceExceptionsCount = batchTest.getConferenceCollection().getExceptionCounterSize();
    alog.info(String.format("Success rate: %f", batchTest.successRate()));
    alog.info(String.format(//from   w  w  w . j  a v  a2 s .  c om
            "ReplaceInfo invocations at dialog level: %d, at call level: %d, at conference level: %d, combined: %d",
            dialogInvocationCount, callInvocationCount, conferenceInvocationCount,
            dialogInvocationCount + callInvocationCount + conferenceInvocationCount));
    alog.info(String.format(
            "Concurrent Exceptions at dialog level: %d, at call level: %d, at conference level: %d, combined: %d",
            dialogExceptionsCount, callExceptionsCount, conferenceExceptionsCount,
            dialogExceptionsCount + callExceptionsCount + conferenceExceptionsCount));
    alog.info(String.format("Total memory  : %d", Runtime.getRuntime().totalMemory()));
    alog.info(String.format("Maximum memory: %d", Runtime.getRuntime().maxMemory()));
    alog.info(String.format("Free memory   : %d", Runtime.getRuntime().freeMemory()));
}

From source file:com.acciente.induction.init.ConfigLoaderInitializer.java

/**
 * Loads the configuration parameters used to configure every module in this dispatcher servlet.
 *
 * @param oServletConfig provides access to the dispatcher's servlet config
 *
 * @return a container with configuration values
 *
 * @throws ClassNotFoundException propagated exception
 * @throws ConstructorNotFoundException propagated exception
 * @throws IllegalAccessException propagated exception
 * @throws InstantiationException propagated exception
 * @throws InvocationTargetException propagated exception
 *
 * Log/*w w w  .j a  va  2s.co m*/
 * Mar 15, 2008 APR  -  created
 */
public static ConfigLoader getConfigLoader(ServletConfig oServletConfig)
        throws ClassNotFoundException, InvocationTargetException, ConstructorNotFoundException,
        ParameterProviderException, IllegalAccessException, InstantiationException {
    ConfigLoader oConfigLoader;
    String sConfigLoaderClassName;
    Log oLog;

    oLog = LogFactory.getLog(ConfigLoaderInitializer.class);

    sConfigLoaderClassName = oServletConfig.getInitParameter(
            oServletConfig.getServletName() + "." + ConfigLoaderInitializer.CONFIG_LOADER_CLASS);

    // first check if there is custom config loader defined
    if (sConfigLoaderClassName == null) {
        // no custom loader defined, use the default XML loader (this is the typical case)
        oConfigLoader = new XMLConfigLoader("induction-" + oServletConfig.getServletName() + ".xml",
                oServletConfig);

        oLog.info("using default XML config loader");
    } else {
        oLog.info("loading user-defined config loader class: " + sConfigLoaderClassName);

        // note that to load this class we use the default class loader since any of our
        // custom classloaders have to wait until we load in the configuration
        Class oConfigLoaderClass = Class.forName(sConfigLoaderClassName);

        // attempt to find and call the single public constructor
        oConfigLoader = (ConfigLoader) ObjectFactory.createObject(oConfigLoaderClass,
                new Object[] { oServletConfig }, null);
    }

    return oConfigLoader;
}