Package org.apache.commons.logging

Examples of org.apache.commons.logging.LogFactory


     * via the TCCL has NOT been loaded. Because this is only accessable via the
     * TCCL, and we've use a commons-logging.properties that disables TCCL loading,
     * we should see the default Log rather than the custom one.
     */
    public void testTcclLoading() throws Exception {
        LogFactory instance = LogFactory.getFactory();
        assertEquals(
                "Correct LogFactory loaded",
                "org.apache.commons.logging.impl.LogFactoryImpl",
                instance.getClass().getName());

        try {
            Log log = instance.getInstance("test");
            fail("Unexpectedly succeeded in loading a custom Log class"
                + " that is only accessable via the tccl.");
            assertNotNull(log); // silence compiler warning about unused var
        } catch(LogConfigurationException ex) {
            // ok, expected
View Full Code Here


     * Verify that the custom Log implementation which is only accessable
     * via the TCCL has successfully been loaded as specified in the config file.
     * This proves that the TCCL was used to load that class.
     */
    public void testTcclLoading() throws Exception {
        LogFactory instance = LogFactory.getFactory();
       
        assertEquals(
            "Correct LogFactory loaded",
            "org.apache.commons.logging.impl.LogFactoryImpl",
            instance.getClass().getName());

        Log log = instance.getInstance("test");
        assertEquals(
            "Correct Log loaded",
            MY_LOG_IMPL,
            log.getClass().getName());
    }
View Full Code Here

     * Don't forget to set the context classloader to whatever it will be
     * when an instance of this class is actually created <i>before</i> calling
     * this method!
     */
    public static void setAllowFlawedContext(String state) {
        LogFactory f = LogFactory.getFactory();
        f.setAttribute(LogFactoryImpl.ALLOW_FLAWED_CONTEXT_PROPERTY, state);
    }
View Full Code Here

    /**
     * Verify that the config file being used is the one containing
     * the desired configId value.
     */
    public void testPriority() throws Exception {
        LogFactory instance = LogFactory.getFactory();
        String id = (String) instance.getAttribute("configId");
        assertEquals("Correct config file loaded", "priority20", id );
    }
View Full Code Here

    /**
     * Test that a LogFactory gets created as expected.
     */
    public void testCreateFactory() {
        LogFactory factory = LogFactory.getFactory();
        assertNotNull("LogFactory exists", factory);
        assertEquals("LogFactory class",
                     "org.apache.commons.logging.impl.LogFactoryImpl",
                     factory.getClass().getName());

        String names[] = factory.getAttributeNames();
        assertNotNull("Names exists", names);
        assertEquals("Names empty", 0, names.length);
    }
View Full Code Here

        Map options = new java.util.HashMap();
        String[] arguments = parseArguments(options, args);

        // Enable the simple command line logging when no other logger is
        // defined.
        LogFactory logFactory = LogFactory.getFactory();
        if (System.getProperty("org.apache.commons.logging.Log") == null) {
            logFactory.setAttribute("org.apache.commons.logging.Log",
                                            CommandLineLogger.class.getName());
        }

        determineLogLevel(options);
View Full Code Here

        Map options = new java.util.HashMap();
        String[] arguments = parseArguments(options, args);

        // Enable the simple command line logging when no other logger is
        // defined.
        LogFactory logFactory = LogFactory.getFactory();
        if (System.getProperty("org.apache.commons.logging.Log") == null) {
            logFactory.setAttribute("org.apache.commons.logging.Log",
                                            CommandLineLogger.class.getName());
        }

        determineLogLevel(options);
View Full Code Here

            task.run();
        }
    }

    public void doStart() {
        LogFactory logFactory = LogFactory.getFactory();
        if (logFactory instanceof GeronimoLogFactory) {
            synchronized (this) {
                timer = new Timer(true);

                // Periodically check the configuration file
View Full Code Here

    /**
     * Construct a command line option object.
     */
    public CommandLineOptions() {
        LogFactory logFactory = LogFactory.getFactory();

        // Enable the simple command line logging when no other logger is
        // defined.
        if (System.getProperty("org.apache.commons.logging.Log") == null) {
            logFactory.setAttribute("org.apache.commons.logging.Log",
                                            CommandLineLogger.class.getName());
            setLogLevel("info");
        }

        log = LogFactory.getLog("FOP");
View Full Code Here

        Map options = new java.util.HashMap();
        String[] arguments = parseArguments(options, args);

        // Enable the simple command line logging when no other logger is
        // defined.
        LogFactory logFactory = LogFactory.getFactory();
        if (System.getProperty("org.apache.commons.logging.Log") == null) {
            logFactory.setAttribute("org.apache.commons.logging.Log",
                                            CommandLineLogger.class.getName());
        }

        determineLogLevel(options);
View Full Code Here

TOP

Related Classes of org.apache.commons.logging.LogFactory

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.