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:org.sbs.htmlunit.HtmlUnitTest.java

@Test
public void testYouku_n_Thread() throws Exception {

    new Thread(new Runnable() {
        @Override//from   ww w  .j  ava2  s  .c om
        public void run() {
            final String url = "http://v.youku.com/v_show/id_XNDc2MDkzMTIw.html";
            String xurl = "http://v.youku.com/v_vpofficiallistv5/id_119023280_showid_271942_page_2?__rt=1&__ro=listitem_page2";
            // ?
            final WebClient webClient = new WebClient(BrowserVersion.FIREFOX_17);

            LogFactory.getFactory().setAttribute("org.apache.commons.logging.Log",
                    "org.apache.commons.logging.impl.NoOpLog");
            java.util.logging.Logger.getLogger("net.sourceforge.htmlunit")
                    .setLevel(java.util.logging.Level.OFF);
            webClient.getOptions().setThrowExceptionOnScriptError(false);
            webClient.getOptions().setThrowExceptionOnFailingStatusCode(false);
            webClient.getOptions().setJavaScriptEnabled(true);
            webClient.getOptions().setActiveXNative(false);
            webClient.getOptions().setCssEnabled(false);
            webClient.getOptions().setThrowExceptionOnScriptError(false);
            webClient.setJavaScriptTimeout(0);
            // ?
            webClient.waitForBackgroundJavaScript(3 * 1000);
            final ResynchronizingAjaxController ac = new ResynchronizingAjaxController();
            webClient.setAjaxController(ac);
            try {
                HtmlPage page = webClient.getPage(url);
                webClient.setJavaScriptTimeout(0);
                webClient.waitForBackgroundJavaScript(3 * 1000);
                List links = (List) page.getByXPath("//*[@id=\"groups_tab\"]/div[1]/ul/li[1]/a");
                if (null != links) {
                    System.out.println(links.size());
                    HtmlAnchor link = (HtmlAnchor) links.get(0);
                    System.out.println(link.asXml());
                    System.err.println("now1 = " + (new Date().toLocaleString()));
                    link.click();
                    //                  webClient.waitForBackgroundJavaScript(3*1000);
                    System.out.println(" @@");
                    System.out.println(" t1 ### " + ac.getResynchronizedCallUlr(10000).toString());
                }
            } catch (FailingHttpStatusCodeException e) {
            } catch (MalformedURLException e) {
                e.printStackTrace();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }, "t1").start();

    new Thread(new Runnable() {
        @Override
        public void run() {
            final String url = "http://v.youku.com/v_show/id_XNDc2MDkzMTIw.html";
            String xurl = "http://v.youku.com/v_vpofficiallistv5/id_119023280_showid_271942_page_2?__rt=1&__ro=listitem_page2";
            // ?
            final WebClient webClient = new WebClient(BrowserVersion.FIREFOX_17);

            LogFactory.getFactory().setAttribute("org.apache.commons.logging.Log",
                    "org.apache.commons.logging.impl.NoOpLog");
            java.util.logging.Logger.getLogger("net.sourceforge.htmlunit")
                    .setLevel(java.util.logging.Level.OFF);
            webClient.getOptions().setThrowExceptionOnScriptError(false);
            webClient.getOptions().setThrowExceptionOnFailingStatusCode(false);
            webClient.getOptions().setJavaScriptEnabled(true);
            webClient.getOptions().setActiveXNative(false);
            webClient.getOptions().setCssEnabled(false);
            webClient.getOptions().setThrowExceptionOnScriptError(false);
            webClient.setJavaScriptTimeout(0);
            webClient.waitForBackgroundJavaScript(3 * 1000);
            final ResynchronizingAjaxController ac = new ResynchronizingAjaxController();
            webClient.setAjaxController(ac);
            try {
                HtmlPage page = webClient.getPage(url);
                webClient.setJavaScriptTimeout(0);
                webClient.waitForBackgroundJavaScript(3 * 1000);
                List links = (List) page.getByXPath("//*[@id=\"groups_tab\"]/div[1]/ul/li[1]/a");
                if (null != links) {
                    System.out.println(links.size());
                    HtmlAnchor link = (HtmlAnchor) links.get(0);
                    System.out.println(link.asXml());
                    System.err.println("now2 = " + (new Date().toLocaleString()));
                    Page p = link.click();
                    System.out.println(" t2 ### " + ac.getResynchronizedCallUlr().toString());
                    //                  System.out.println(p.getUrl().toString());
                }
            } catch (FailingHttpStatusCodeException e) {
            } catch (MalformedURLException e) {
                e.printStackTrace();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }, "t2").start();

}

From source file:org.smartfrog.services.xunit.testng.test.targets.LoggingTest.java

@BeforeClass
public void setUp() {
    LogFactory lf = LogFactory.getFactory();
    log = LogFactory.getLog(getClass());
}

From source file:org.socraticgrid.presentationservices.DiagnosticsTests.java

@Before
public void setUp() {
    LogFactory.getFactory().setAttribute("org.apache.commons.logging.Log",
            "org.apache.commons.logging.impl.NoOpLog");
    System.out.println("DIAGNOSTICS TESTS - HOST IS: " + server);
}

From source file:org.socraticgrid.presentationservices.GetAddressBookTest.java

@Before
public void setUp() {
    LogFactory.getFactory().setAttribute("org.apache.commons.logging.Log",
            "org.apache.commons.logging.impl.NoOpLog");
    System.out.println("GETMESSAGEDETAIL HOST IS: " + server);
}

From source file:org.socraticgrid.presentationservices.GetCalendarTest.java

@Before
public void setUp() {
    LogFactory.getFactory().setAttribute("org.apache.commons.logging.Log",
            "org.apache.commons.logging.impl.NoOpLog");
    System.out.println("GETCALENDAR HOST IS: " + server);
}

From source file:org.socraticgrid.presentationservices.GetECSTest.java

@Before
public void setUp() {
    LogFactory.getFactory().setAttribute("org.apache.commons.logging.Log",
            "org.apache.commons.logging.impl.NoOpLog");
    System.out.println("GET ECS TEST HOST IS: " + server);
}

From source file:org.socraticgrid.presentationservices.GetMessagesEmailTest.java

@Before
public void setUp() {
    System.out.println("\n\nGETMESSAGESEMAIL Test beginning: " + new Date());
    LogFactory.getFactory().setAttribute("org.apache.commons.logging.Log",
            "org.apache.commons.logging.impl.NoOpLog");
    System.out.println("GETMESSAGESEMAIL HOST IS: " + server);
}

From source file:org.socraticgrid.presentationservices.GetMessagesTest.java

@Before
public void setUp() {
    System.out.println("\n\nGETMESSAGES Test beginning: " + new Date());
    LogFactory.getFactory().setAttribute("org.apache.commons.logging.Log",
            "org.apache.commons.logging.impl.NoOpLog");
    System.out.println("GETMESSAGES HOST IS: " + server);
}

From source file:org.socraticgrid.presentationservices.GetPatientDataTest.java

@Before
public void setUp() {
    LogFactory.getFactory().setAttribute("org.apache.commons.logging.Log",
            "org.apache.commons.logging.impl.NoOpLog");
    System.out.println("GETPATIENTDATA HOST IS: " + server);
}

From source file:org.socraticgrid.presentationservices.SetAccountTest.java

@Before
public void setUp() {
    LogFactory.getFactory().setAttribute("org.apache.commons.logging.Log",
            "org.apache.commons.logging.impl.NoOpLog");
    System.out.println("MAINTAINACCOUNT HOST IS: " + server);
}