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

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

Introduction

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

Prototype

@Deprecated
public static LogFactory getFactory() 

Source Link

Document

This method only exists for compatibility with unusual Commons Logging API usage like e.g.

Usage

From source file:fr.gouv.vitam.utils.logging.CommonsLoggerFactory.java

@Override
protected void seLevelSpecific(final VitamLogLevel level) {
    // XXX FIXME does not work for Apache Commons Logger
    switch (level) {
    case TRACE:/* w  w w.  j av a2 s . c  o m*/
        LogFactory.getFactory().setAttribute(LogFactory.PRIORITY_KEY, Level.FINEST);
        break;
    case DEBUG:
        LogFactory.getFactory().setAttribute(LogFactory.PRIORITY_KEY, Level.FINE);
        break;
    case INFO:
        LogFactory.getFactory().setAttribute(LogFactory.PRIORITY_KEY, Level.INFO);
        break;
    case WARN:
        LogFactory.getFactory().setAttribute(LogFactory.PRIORITY_KEY, Level.WARNING);
        break;
    case ERROR:
        LogFactory.getFactory().setAttribute(LogFactory.PRIORITY_KEY, Level.SEVERE);
        break;
    default:
        LogFactory.getFactory().setAttribute(LogFactory.PRIORITY_KEY, Level.WARNING);
        break;
    }
}

From source file:net.jperf.commonslog.CommonsLogStopWatchTest.java

protected void tearDown() throws Exception {
    LogFactory.getFactory().setAttribute(LogFactoryImpl.LOG_PROPERTY, originalLogFactoryAttribute);
    super.tearDown();
}

From source file:net.sf.hajdbc.logging.commons.CommonsLoggingProvider.java

/**
 * {@inheritDoc}//  ww w  . jav  a  2s  .  com
 * @see net.sf.hajdbc.logging.LoggingProvider#isEnabled()
 */
@Override
public boolean isEnabled() {
    try {
        LogFactory.getFactory();

        return true;
    } catch (LogConfigurationException e) {
        return false;
    }
}

From source file:de.drv.dsrv.spoc.web.listener.LoggingContextListener.java

/**
 * @see ServletContextListener#contextInitialized(ServletContextEvent)
 *//*w w  w . j a  v a  2 s . c  o m*/
@Override
public void contextInitialized(final ServletContextEvent event) {

    PropertyConfigurator.configure(this.log4jResource);

    LogFactory.getFactory().setAttribute("org.apache.commons.logging.Log",
            "org.apache.commons.logging.impl.Log4JLogger");

}

From source file:io.github.bonigarcia.wdm.EdgeDriverManager.java

@Override
public List<URL> getDrivers() throws Exception {
    String edgeDriverUrl = WdmConfig.getString("wdm.edgeDriverUrl");
    log.debug("Reading {} to find out the latest version of Edge driver", edgeDriverUrl);

    // Switch off HtmlUnit logging
    LogFactory.getFactory().setAttribute("org.apache.commons.logging.Log",
            "org.apache.commons.logging.impl.NoOpLog");
    java.util.logging.Logger.getLogger("com.gargoylesoftware.htmlunit").setLevel(Level.OFF);
    java.util.logging.Logger.getLogger("org.apache.commons.httpclient").setLevel(Level.OFF);

    // Using HtmlUnitDriver to read URL and version
    HtmlUnitDriver driver = new HtmlUnitDriver();
    driver.manage().timeouts().implicitlyWait(WdmConfig.getInt("wdm.timeout"), TimeUnit.SECONDS);
    driver.get(edgeDriverUrl);// ww  w.ja v a  2  s .c o  m

    driver.findElement(By.linkText("Details")).click();
    WebElement versionElement = driver
            .findElement(By.xpath("//*[contains(text(), 'Version:')]/parent::*/following-sibling::*"));
    versionToDownload = versionElement.getText();

    driver.findElement(By.linkText("Download")).click();
    WebElement clickHere = driver.findElement(By.linkText("Click here"));
    String downloadLink = clickHere.getAttribute("href");
    List<URL> urlList = new ArrayList<>();
    urlList.add(new URL(downloadLink));

    return urlList;
}

From source file:net.sourceforge.floggy.persistence.WeaverTask.java

/**
 * DOCUMENT ME!//w w w  . j a  v a 2 s.  c om
*
* @throws BuildException DOCUMENT ME!
*/
public void execute() throws BuildException {
    AntLog.setTask(this);
    LogFactory.getFactory().setAttribute("org.apache.commons.logging.Log", AntLog.class.getName());

    Weaver weaver = new Weaver();

    try {
        weaver.setClasspath(classpath.list());
        weaver.setInputFile(input);
        weaver.setOutputFile(output);

        if (configurationFile == null) {
            Configuration configuration = new Configuration();
            configuration.setAddDefaultConstructor(addDefaultConstructor);
            configuration.setGenerateSource(generateSource);
            weaver.setConfiguration(configuration);
        } else {
            weaver.setConfigurationFile(configurationFile);
        }

        weaver.execute();
    } catch (WeaverException e) {
        throw new BuildException(e);
    }
}

From source file:io.github.bonigarcia.wdm.PhantomJsDriverManager.java

@Override
public List<URL> getDrivers() throws Exception {
    String phantomjsDriverUrl = WdmConfig.getString("wdm.phantomjsDriverUrl");
    log.debug("Reading {} to find out the latest version of PhantomJS driver", phantomjsDriverUrl);

    // Switch off HtmlUnit logging
    LogFactory.getFactory().setAttribute("org.apache.commons.logging.Log",
            "org.apache.commons.logging.impl.NoOpLog");
    java.util.logging.Logger.getLogger("com.gargoylesoftware.htmlunit").setLevel(Level.OFF);
    java.util.logging.Logger.getLogger("org.apache.commons.httpclient").setLevel(Level.OFF);

    // Using HtmlUnitDriver to read package URL
    WebDriver driver = new HtmlUnitDriver();
    driver.manage().timeouts().implicitlyWait(WdmConfig.getInt("wdm.timeout"), TimeUnit.SECONDS);
    driver.get(phantomjsDriverUrl);/* w  ww  .j  a  v a  2 s .c om*/
    WebElement downloadsTable = driver.findElement(By.id("available-downloads"));
    List<WebElement> links = downloadsTable.findElements(By
            .xpath("//table[@id='uploaded-files']/tbody/tr[@class='iterable-item']/td[@class='name']" + "/a"));
    List<URL> urlList = new ArrayList<>(links.size());
    for (WebElement element : links) {
        String href = element.getAttribute("href");
        urlList.add(new URL(href));
    }
    return urlList;
}

From source file:com.sebuilder.interpreter.TestRun.java

public TestRun(Script script) {
    this.script = script;
    log = LogFactory.getFactory().getInstance(SeInterpreter.class);
}

From source file:net.openhft.chronicle.logger.jcl.JclVanillaChronicleLoggerTest.java

@Test
public void testLogFactory() {
    assertEquals(ChronicleLoggerFactory.class, LogFactory.getFactory().getClass());
}

From source file:net.openhft.chronicle.logger.jcl.JclIndexedChronicleLoggerTest.java

@Test
public void testLoggerFactory() {
    assertEquals(ChronicleLoggerFactory.class, LogFactory.getFactory().getClass());
}