Package org.apache.logging.log4j.core

Examples of org.apache.logging.log4j.core.LoggerContext


     * @param currentContext If true returns the current Context, if false returns the Context appropriate
     * for the caller if a more appropriate Context can be determined.
     * @return The LoggerContext.
     */
    public LoggerContext getContext(String fqcn, boolean currentContext) {
        LoggerContext ctx = selector.getContext(fqcn, currentContext);
        synchronized (ctx) {
            if (recursive.get() != null || ctx.isStarted()) {
                return ctx;
            }
            try {
                recursive.set(this);
                ctx.start();
                return ctx;
            } finally {
                recursive.remove();
            }
        }
View Full Code Here


    private static final String CONFIG = "log4j-test1.xml";

    @BeforeClass
    public static void setUpClass() {
        System.setProperty(XMLConfigurationFactory.CONFIGURATION_FILE_PROPERTY, CONFIG);
        final LoggerContext context = (LoggerContext) LogManager.getContext(false);
        context.getConfiguration();
    }
View Full Code Here

    }

    @AfterClass
    public static void cleanUpClass() {
        System.clearProperty(XMLConfigurationFactory.CONFIGURATION_FILE_PROPERTY);
        final LoggerContext context = (LoggerContext) LogManager.getContext(false);
        context.reconfigure();
        StatusLogger.getLogger().reset();
    }
View Full Code Here

                "This is another test");
    }

    @SuppressWarnings("unchecked")
    private void verify(final String expected) {
        final LoggerContext ctx = (LoggerContext) LogManager.getContext(false);
        final Map<String, Appender<?>> list = ctx.getConfiguration().getAppenders();
        final Appender<?> listApp = list.get("List");
        assertNotNull("Missing Appender", listApp);
        assertTrue("Not a ListAppender", listApp instanceof ListAppender);
        final List<String> events = ((ListAppender<String>) listApp).getMessages();
        try
View Full Code Here

    private static final String CONFIG = "log4j-test1.xml";

    @BeforeClass
    public static void setUpClass() {
        System.setProperty(XMLConfigurationFactory.CONFIGURATION_FILE_PROPERTY, CONFIG);
        final LoggerContext context = (LoggerContext) LogManager.getContext(false);
        context.getConfiguration();
    }
View Full Code Here

    }

    @AfterClass
    public static void cleanUpClass() {
        System.clearProperty(XMLConfigurationFactory.CONFIGURATION_FILE_PROPERTY);
        final LoggerContext context = (LoggerContext) LogManager.getContext(false);
        context.reconfigure();
        StatusLogger.getLogger().reset();
    }
View Full Code Here

        verify("catching WARN M-CATCHING[ EXCEPTION ] E java.lang.Error: This is the last test.");
    }

    @SuppressWarnings("unchecked")
    private void verify(final String expected) {
        final LoggerContext ctx = (LoggerContext) LogManager.getContext(false);
        final Map<String, Appender<?>> list = ctx.getConfiguration().getAppenders();
        final Appender<?> listApp = list.get("List");
        assertNotNull("Missing Appender", listApp);
        assertTrue("Not a ListAppender", listApp instanceof ListAppender);
        final List<String> events = ((ListAppender<String>) listApp).getMessages();
        try
View Full Code Here

    private static final String CONFIG = "log4j-test1.xml";

    @BeforeClass
    public static void setUpClass() {
        System.setProperty(XMLConfigurationFactory.CONFIGURATION_FILE_PROPERTY, CONFIG);
        final LoggerContext context = (LoggerContext) LogManager.getContext(false);
        context.getConfiguration();
    }
View Full Code Here

    }

    @AfterClass
    public static void cleanUpClass() {
        System.clearProperty(XMLConfigurationFactory.CONFIGURATION_FILE_PROPERTY);
        final LoggerContext context = (LoggerContext) LogManager.getContext(false);
        context.reconfigure();
        StatusLogger.getLogger().reset();
    }
View Full Code Here

        verify("exit with(5792) TRACE M-EXIT[ FLOW ] E");
    }

    @SuppressWarnings("unchecked")
    private void verify(final String expected) {
        final LoggerContext ctx = (LoggerContext) LogManager.getContext(false);
        final Map<String, Appender<?>> list = ctx.getConfiguration().getAppenders();
        final Appender<?> listApp = list.get("List");
        assertNotNull("Missing Appender", listApp);
        assertTrue("Not a ListAppender", listApp instanceof ListAppender);
        final List<String> events = ((ListAppender<String>) listApp).getMessages();
        try
View Full Code Here

TOP

Related Classes of org.apache.logging.log4j.core.LoggerContext

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.