Package org.apache.logging.log4j.core

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


     */
    @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

    }
    try {
      LoggerContext ctx = (LoggerContext) LogManager.getContext(false);
      URL url = ResourceUtils.getURL(location);
      ConfigurationSource source = new ConfigurationSource(url.openStream(), url);
      ctx.start(ConfigurationFactory.getInstance().getConfiguration(source));
    }
    catch (Exception ex) {
      throw new IllegalStateException("Could not initialize Log4J2 logging from "
          + location, ex);
    }
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

    public LoggerContext getContext(final String fqcn, final ClassLoader loader, final Object externalContext,
                                    final boolean currentContext) {
        final LoggerContext ctx = selector.getContext(fqcn, loader, currentContext);
        ctx.setExternalContext(externalContext);
        if (ctx.getStatus() == LoggerContext.Status.INITIALIZED) {
            ctx.start();
        }
        return ctx;
    }

    /**
 
View Full Code Here

        }
        if (ctx.getStatus() == LoggerContext.Status.INITIALIZED) {
            if (configLocation != null || name != null) {
                ContextAnchor.THREAD_CONTEXT.set(ctx);
                final Configuration config = ConfigurationFactory.getInstance().getConfiguration(name, configLocation);
                ctx.start(config);
                ContextAnchor.THREAD_CONTEXT.remove();
            } else {
                ctx.start();
            }
        }
View Full Code Here

                ContextAnchor.THREAD_CONTEXT.set(ctx);
                final Configuration config = ConfigurationFactory.getInstance().getConfiguration(name, configLocation);
                ctx.start(config);
                ContextAnchor.THREAD_CONTEXT.remove();
            } else {
                ctx.start();
            }
        }
        return ctx;
    }
View Full Code Here

        }
        if (ctx.getStatus() == LoggerContext.Status.INITIALIZED) {
            if (source != null) {
                ContextAnchor.THREAD_CONTEXT.set(ctx);
                final Configuration config = ConfigurationFactory.getInstance().getConfiguration(source);
                ctx.start(config);
                ContextAnchor.THREAD_CONTEXT.remove();
            } else {
                ctx.start();
            }
        }
View Full Code Here

                ContextAnchor.THREAD_CONTEXT.set(ctx);
                final Configuration config = ConfigurationFactory.getInstance().getConfiguration(source);
                ctx.start(config);
                ContextAnchor.THREAD_CONTEXT.remove();
            } else {
                ctx.start();
            }
        }
        return ctx;
    }
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

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.