Package org.apache.logging.log4j.test.appender

Examples of org.apache.logging.log4j.test.appender.ListAppender.clear()


            assertTrue("Expected line 1 to end with: " + line1 + " Actual " + list.get(0), list.get(0).endsWith(line1));
            assertTrue("Expected line 2 to end with: " + line2 + " Actual " + list.get(1), list.get(1).endsWith(line2));
            assertTrue("Expected line 3 to end with: " + line3 + " Actual " + list.get(2), list.get(2).endsWith(line3));
            assertTrue("Expected line 4 to end with: " + line4 + " Actual " + list.get(3), list.get(3).endsWith(line4));

            appender.clear();

            ThreadContext.remove("loginId");

            root.debug("This is a test");
View Full Code Here


        category.getLogger().addAppender(appender);
        category.error("Test Message");
        List<String> msgs = appender.getMessages();
        assertTrue("Incorrect number of messages. Expected 1 got " + msgs.size(), msgs.size() == 1);
        String msg = msgs.get(0);
        appender.clear();
        String expected = "ERROR o.a.l.CategoryTest [main] Test Message" + LINE_SEP;
        assertTrue("Incorrect message \"" + msg + "\"" + " expected \"" + expected +"\"", msg.endsWith(expected));
    }

    /**
 
View Full Code Here

            assertTrue("Expected line 1 to end with: " + line1 + " Actual " + list.get(0), list.get(0).endsWith(line1));
            assertTrue("Expected line 2 to end with: " + line2 + " Actual " + list.get(1), list.get(1).endsWith(line2));
            assertTrue("Expected line 3 to end with: " + line3 + " Actual " + list.get(2), list.get(2).endsWith(line3));
            assertTrue("Expected line 4 to end with: " + line4 + " Actual " + list.get(3), list.get(3).endsWith(line4));

            appender.clear();

            ThreadContext.remove("loginId");

            root.debug("This is a test");
View Full Code Here

            final List<String> list = appender.getMessages();

            assertTrue("Not enough list entries", list.size() > 1);
            assertTrue("No Exception", list.get(1).contains("IllegalArgumentException"));

            appender.clear();
        } finally {
            root.removeAppender(appender);
            ThreadContext.clear();

            appender.stop();
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.