Example usage for org.apache.commons.logging LogFactory getLog

List of usage examples for org.apache.commons.logging LogFactory getLog

Introduction

In this page you can find the example usage for org.apache.commons.logging LogFactory getLog.

Prototype

public static Log getLog(String name) 

Source Link

Document

Convenience method to return a named logger.

Usage

From source file:de.xwic.appkit.core.util.UStream.java

/**
 * @param closeables/*from w  w w  .  j  av  a  2s.  c  o  m*/
 */
public static void close(final Closeable... closeables) {
    for (Closeable closeable : closeables) {
        if (closeable == null) {
            continue;
        }
        try {
            closeable.close();
        } catch (IOException e) {
            LogFactory.getLog(UStream.class).error("Failed to close stream", e);
        }
    }
}

From source file:com.arkatay.yada.base.Time.java

/**
 * Initializes the time system//from   w w  w.j a  va  2  s .  co m
 *
 */
public static void init() {
    // Create a logger for this class
    Log log = LogFactory.getLog(Time.class);

    // try the nanoTime method
    useNanoTimeMethod = true;
    try {
        System.nanoTime();
    } catch (NoSuchMethodError err) {
        initTimeMillis = System.currentTimeMillis();
        useNanoTimeMethod = false;
        log.warn("!!!");
        log.warn("!!! The java runtime does not support the System.nanoTime method and this means that the");
        log.warn("!!! timer accuracy on some computer may be too low for the codec to function properly!");
        log.warn("!!! Consider using JRE 1.5.x or higher which supports the nanoTime method");
        log.warn("!!!");
    }
}

From source file:net.sf.janos.util.EntryHelper.java

/**
 * Creates an Entry for the given url.//from   w ww  .  j a  va2s  . com
 * @param url the String representation of the url. format: [[scheme:]//]host[:port]/resource
 * @return An entry that refers to the given url resource
 */
public static final Entry createEntryForUrl(String url) {
    String res;
    if (url.startsWith("http:")) {
        // replace protocol part
        res = "x-rincon-mp3radio:" + url.substring(5);
    } else if (url.startsWith("//")) {
        res = "x-rincon-mp3radio:" + url;
    } else {
        res = "x-rincon-mp3radio://" + url;
    }
    LogFactory.getLog(EntryHelper.class).debug("Created Entry for url: " + url);
    return new Entry("URL:" + url, url, "URL:", "URL", "", "", "object.item.audioItem.audioBroadcast", res);

}

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

public static ClassLoader getClassLoader(Config.JavaClassPath oJavaClassPathConfig,
        ClassLoader oParentClassLoader) throws ClassNotFoundException {
    Log oLog;// ww w  .j a va 2 s  .c  o m

    oLog = LogFactory.getLog(ClassLoaderInitializer.class);

    if (oJavaClassPathConfig.getDirList().size() == 0) {
        return oParentClassLoader;
    } else {
        ReloadingClassLoader oClassLoader = new ReloadingClassLoader(oParentClassLoader);

        // we will ignore any dependencies for classes in any of the following packages
        oClassLoader.addIgnoredClassNamePrefix("java.");
        oClassLoader.addIgnoredClassNamePrefix("javax.");
        oClassLoader.addIgnoredClassNamePrefix("com.acciente.");

        // if there is a classpath defined setup a reloading classloader to handle the specified directories
        for (int i = 0; i < oJavaClassPathConfig.getDirList().size(); i++) {
            if (oJavaClassPathConfig.getDirList().get(i) instanceof Config.JavaClassPath.CompiledDir) {
                Config.JavaClassPath.CompiledDir oCompiledDir = (Config.JavaClassPath.CompiledDir) oJavaClassPathConfig
                        .getDirList().get(i);

                oLog.info(
                        "configuring reloading classloader for compiled classes in: " + oCompiledDir.getDir());

                // set up a compiled class definition loader
                JavaCompiledClassDefLoader oJavaCompiledClassDefLoader = new JavaCompiledClassDefLoader();
                oJavaCompiledClassDefLoader.setCompiledDirectory(oCompiledDir.getDir());
                oJavaCompiledClassDefLoader.setPackageNamePrefix(oCompiledDir.getPackageNamePrefix());

                // add the class def loader to the search list
                oClassLoader.addClassDefLoader(oJavaCompiledClassDefLoader);
            }
        }

        return oClassLoader;
    }
}

From source file:edu.indiana.lib.twinpeaks.util.LogUtils.java

/**
 * Get a Log instance
 * @param logName Name being logged
 */
public static Log getLog(String logName) {
    return LogFactory.getLog(logName);
}

From source file:br.com.sicoob.cro.cop.batch.core.TaskletListenerImpl.java

public void beforeStep(BatchStepContribution stepExecution) {
    LogFactory.getLog(TaskletListenerImpl.class).info("BEFORE - STEP - TASKLET");
}

From source file:gridool.routing.GridNodeSelectorFactory.java

public static GridNodeSelector createSelector() {
    final String selectorName = Settings.get("gridool.router.nodeselector");
    if (PrimaryNodeSelector.class.getName().equals(selectorName)) {
        return new PrimaryNodeSelector();
    } else if (LoadBalancingNodeSelector.class.getName().equals(selectorName)) {
        return new LoadBalancingNodeSelector();
    } else {/*from   w  ww . j  a  v  a  2 s.c om*/
        LogFactory.getLog(GridNodeSelectorFactory.class).warn(
                "GridNodeSelector '" + selectorName + "' not found. Use the default PrimaryNodeSelector.");
    }
    return new PrimaryNodeSelector();
}

From source file:framework.retrieval.engine.common.RetrievalUtil.java

@SuppressWarnings("unchecked")
public static Log getLog(Class clazz) {
    Log log = LogFactory.getLog(clazz);
    return log;
}

From source file:mangotiger.poker.channel.EventLogger.java

public void on(final Object object) {
    LogFactory.getLog(EventLogger.class).info(object);
}

From source file:com.amazonaws.util.Throwables.java

/**
 * Returns the root cause of the given throwable, or null if the given
 * throwable is null. If the root cause is over 1000 level deep, the
 * original throwable will be returned defensively as this is heuristically
 * considered a circular reference, however unlikely.
 *///from   w  ww. jav a 2  s. c o m
public static Throwable getRootCause(Throwable orig) {
    if (orig == null)
        return orig;
    Throwable t = orig;
    // defend against (malicious?) circularity
    for (int i = 0; i < 1000; i++) {
        Throwable cause = t.getCause();
        if (cause == null)
            return t;
        t = cause;
    }
    // Too bad.  Return the original exception.
    LogFactory.getLog(Throwables.class)
            .debug("Possible circular reference detected on " + orig.getClass() + ": [" + orig + "]");
    return orig;
}