Package org.apache.logging.log4j.core

Examples of org.apache.logging.log4j.core.LoggerContext.start()


            if (selector instanceof NamedContextSelector) {
                this.namedContextSelector = (NamedContextSelector) selector;
                context = this.namedContextSelector.locateContext(this.name, this.servletContext, configLocation);
                ContextAnchor.THREAD_CONTEXT.set(context);
                if (context.isInitialized()) {
                    context.start();
                }
                ContextAnchor.THREAD_CONTEXT.remove();
            } else {
                // won't it be amusing if the servlet container uses Log4j as its ServletContext logger?
                this.servletContext.log("Potential problem: Selector is not an instance of NamedContextSelector.");
View Full Code Here


     */
    @Override
    public LoggerContext getContext(final String fqcn, final ClassLoader loader, final boolean currentContext) {
        final LoggerContext ctx = selector.getContext(fqcn, loader, currentContext);
        if (ctx.getStatus() == LoggerContext.Status.INITIALIZED) {
            ctx.start();
        }
        return ctx;
    }

    /**
 
View Full Code Here

    @Override
    public LoggerContext getContext(final String fqcn, final ClassLoader loader, final boolean currentContext,
            final URI configLocation) {
        final LoggerContext ctx = selector.getContext(fqcn, loader, currentContext, configLocation);
        if (ctx.getStatus() == LoggerContext.Status.INITIALIZED) {
            ctx.start();
        }
        return ctx;
    }

View Full Code Here

                ContextAnchor.THREAD_CONTEXT.set(ctx);
                if (externalContext != null) {
                    ctx.setExternalContext(externalContext);
                }
                final Configuration config = ConfigurationFactory.getInstance().getConfiguration(name, configLocation);
                ctx.start(config);
                ContextAnchor.THREAD_CONTEXT.remove();
                return ctx;
            } else {
                LOGGER.error("LogManager returned an instance of {} which does not implement {}. Unable to initialize Log4j",
                    context.getClass().getName(), LoggerContext.class.getName());
View Full Code Here

            final org.apache.logging.log4j.spi.LoggerContext context = LogManager.getContext(loader, false, configLocation);
            if (context instanceof LoggerContext) {
                final LoggerContext ctx = (LoggerContext) context;
                ContextAnchor.THREAD_CONTEXT.set(ctx);
                final Configuration config = ConfigurationFactory.getInstance().getConfiguration(source);
                ctx.start(config);
                ContextAnchor.THREAD_CONTEXT.remove();
                return ctx;
            } else {
                LOGGER.error("LogManager returned an instance of {} which does not implement {}. Unable to initialize Log4j",
                    context.getClass().getName(), LoggerContext.class.getName());
View Full Code Here

            if (selector instanceof NamedContextSelector) {
                this.selector = (NamedContextSelector) selector;
                loggerContext = this.selector.locateContext(this.name, this.servletContext, configLocation);
                ContextAnchor.THREAD_CONTEXT.set(loggerContext);
                if (loggerContext.getStatus() == LoggerContext.Status.INITIALIZED) {
                    loggerContext.start();
                }
                ContextAnchor.THREAD_CONTEXT.remove();
            } else {
                this.servletContext.log("Potential problem: Selector is not an instance of NamedContextSelector.");
                return;
View Full Code Here

        final Map<Object, Map<String, String>> entries = InMemoryAdvertiser.getAdvertisedEntries();
        assertTrue("Entries found: " + entries, entries.isEmpty());

        //reconfigure for subsequent testing
        ctx.start();
    }

    @Test
    public void testAdvertisementsAddedOnReconfigAfterStop() {
        verifyExpectedEntriesAdvertised(InMemoryAdvertiser.getAdvertisedEntries());
View Full Code Here

        ctx.stop();

        final Map<Object, Map<String, String>> entries = InMemoryAdvertiser.getAdvertisedEntries();
        assertTrue("Entries found: " + entries, entries.isEmpty());

        ctx.start();

        verifyExpectedEntriesAdvertised(InMemoryAdvertiser.getAdvertisedEntries());
    }
}
View Full Code Here

        try {
            org.apache.logging.log4j.spi.LoggerContext context = LogManager.getContext(loader, false, configLocation);
            if (context instanceof LoggerContext) {
                final LoggerContext ctx = (LoggerContext) context;
                final Configuration config = ConfigurationFactory.getInstance().getConfiguration(name, configLocation);
                ctx.start(config);
                return ctx;
            } else {
                LOGGER.error("LogManager returned an instance of {} which does not implement {}. Unable to initialize Log4j",
                    context.getClass().getName(), LoggerContext.class.getName());
            }
View Full Code Here

            }
            org.apache.logging.log4j.spi.LoggerContext context = LogManager.getContext(loader, false, configLocation);
            if (context instanceof LoggerContext) {
                final LoggerContext ctx = (LoggerContext) context;
                final Configuration config = ConfigurationFactory.getInstance().getConfiguration(source);
                ctx.start(config);
                return ctx;
            } else {
                LOGGER.error("LogManager returned an instance of {} which does not implement {}. Unable to initialize Log4j",
                    context.getClass().getName(), LoggerContext.class.getName());
            }
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.