Examples of LogFactory


Examples of org.apache.commons.logging.LogFactory

     * TCCL, and we've use a commons-logging.properties that disables TCCL loading,
     * we should see the default LogFactoryImpl rather than the custom one.
     */
    public void testTcclLoading() throws Exception {
        try {
            LogFactory instance = LogFactory.getFactory();
            fail("Unexpectedly succeeded in loading custom factory, though TCCL disabled.");
            assertNotNull(instance); // silence warning about unused var
        } catch(org.apache.commons.logging.LogConfigurationException ex) {
            // ok, custom MyLogFactoryImpl as specified in props_disable_tccl
            // could not be found.
View Full Code Here

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

Examples of org.apache.derby.iapi.store.raw.log.LogFactory

    {
        //creating readme in "seg0" directory
        rawstore.createDataWarningFile();

        //creating readme in log directory
        LogFactory logFactory =(LogFactory) Monitor.findServiceModule(this, rawstore.getLogFactoryModule());
        logFactory.createDataWarningFile();

        //creating readme in root database directory
        DataFactory dataFactory =(DataFactory) Monitor.findServiceModule(this, rawstore.getDataFactoryModule());
        PersistentService ps = Monitor.getMonitor().getServiceType(rawstore);
        ps.createDataWarningFile(dataFactory.getStorageFactory());
View Full Code Here

Examples of org.apache.juli.logging.LogFactory

        try {
            final ClassLoader tccl = thread.getContextClassLoader(); // this is in classpath not StandardClassLoader so use reflection
            final Class<?> logger = tccl.loadClass("org.apache.openejb.util.Logger");
            final Method m = logger.getDeclaredMethod("delegateClass");
            final String clazz = (String) m.invoke(null);
            final LogFactory factory;
            if ("org.apache.openejb.util.Log4jLogStreamFactory".equals(clazz)) {
                factory = LogFactory.class.cast(tccl.loadClass("org.apache.tomee.loader.log.Log4jLogFactory").newInstance());
            } else if ("org.apache.openejb.util.Slf4jLogStreamFactory".equals(clazz)) {
                factory = LogFactory.class.cast(tccl.loadClass("org.apache.tomee.loader.log.Slf4jLogFactory").newInstance());
            } else {
                factory = null;
            }
            if (factory != null) {
                final LogFactory oldFactory = getFactory();
                final Collection<String> names = new ArrayList<String>(oldFactory.getNames());
                oldFactory.getNames().clear();
                oldFactory.release();
                setSingleton(factory);
                reload(factory, tccl, names);
            }
        } catch (final Throwable th) {
            System.err.println(th.getClass().getName() + ": " + th.getMessage());
View Full Code Here

Examples of org.apache.openjpa.lib.log.LogFactory

        cp.setInto(this);
        setDiagnosticContext(this);
    }
   
    private void setDiagnosticContext(OpenJPAConfiguration conf) {
        LogFactory logFactory = conf.getLogFactory();
        try {
            Method setter = AccessController.doPrivileged(J2DoPrivHelper.
                    getDeclaredMethodAction(logFactory.getClass(),
                    "setDiagnosticContext", new Class[]{String.class}));
            setter.invoke(logFactory, conf.getId());
        } catch (Throwable t) {
            // no contextual logging
        }
View Full Code Here

Examples of org.apache.openjpa.lib.log.LogFactory

        cp.setInto(this);
        setDiagnosticContext(this);
    }
   
    private void setDiagnosticContext(OpenJPAConfiguration conf) {
        LogFactory logFactory = conf.getLogFactory();
        try {
            Method setter = AccessController.doPrivileged(J2DoPrivHelper.
                    getDeclaredMethodAction(logFactory.getClass(),
                    "setDiagnosticContext", new Class[]{String.class}));
            setter.invoke(logFactory, conf.getId());
        } catch (Throwable t) {
            // no contextual logging
        }
View Full Code Here

Examples of org.apache.openjpa.lib.log.LogFactory

        this(unit, null);
    }
   
    public Exchange(String unit, Map<String,Object> config) {
        super(unit, false, PersistenceContextType.TRANSACTION, addLog(config));
        LogFactory serverLog = getUnit().getConfiguration().getLogFactory();
        try {
            log = (BufferedLog)serverLog;
        } catch (ClassCastException e) {
            System.err.println("Local Log was loaded by " + BufferedLog.class.getClassLoader());
            System.err.println("Server Log was loaded by " + serverLog.getClass().getClassLoader());
            e.printStackTrace();
        }
        populate();
        new MarketFeed(this).start(60*1000);
    }
View Full Code Here

Examples of org.apache.openjpa.lib.log.LogFactory

        cp.setInto(this);
        setDiagnosticContext(this);
    }
   
    private void setDiagnosticContext(OpenJPAConfiguration conf) {
        LogFactory logFactory = conf.getLogFactory();
        try {
            Method setter = AccessController.doPrivileged(J2DoPrivHelper.
                    getDeclaredMethodAction(logFactory.getClass(),
                    "setDiagnosticContext", new Class[]{String.class}));
            setter.invoke(logFactory, conf.getId());
        } catch (Throwable t) {
            // no contextual logging
        }
View Full Code Here

Examples of org.apache.openjpa.lib.log.LogFactory

        Object unit = p.get(PREFIX_OPENJPA+id.getProperty());
        return (unit == null) ? "?" : unit.toString();
    }
   
    private void setDiagnosticContext(String unit) {
        LogFactory logFactory = getLogFactory();
        if (logFactory instanceof LogFactoryImpl) {
            ((LogFactoryImpl)logFactory).setDiagnosticContext(unit);
        }
    }
View Full Code Here

Examples of org.snmp4j.log.LogFactory


//--AgentGen BEGIN=_METHODS

  private OctetString getLogSysDescr() {
    LogFactory logFactory = LogFactory.getLogFactory();
    if (logFactory == null) {
      return new OctetString();
    }
    return new OctetString(logFactory.toString());
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.