Package org.apache.logging.log4j.core.lookup

Examples of org.apache.logging.log4j.core.lookup.StrSubstitutor


            LoggerContext ctx = ContextAnchor.THREAD_CONTEXT.get();
            assertNotNull("No LoggerContext", ctx);
            assertNotNull("No ServletContext", ctx.getExternalContext());
            Configuration config = ctx.getConfiguration();
            assertNotNull("No Configuration", config);
            StrSubstitutor substitutor = config.getStrSubstitutor();
            assertNotNull("No Interpolator", substitutor);
            String value = substitutor.replace("${web:initParam.TestParam}");
            assertNotNull("No value for TestParam", value);
            assertEquals("Incorrect value for TestParam: " + value, "ParamValue", value);
            value = substitutor.replace("${web:attr.TestAttr}");
            assertNotNull("No value for TestAttr", value);
            assertEquals("Incorrect value for TestAttr: " + value, "AttrValue", value);
            value = substitutor.replace("${web:Name1}");
            assertNotNull("No value for Name1", value);
            assertEquals("Incorrect value for Name1: " + value, "Ben", value);
            value = substitutor.replace("${web:Name2}");
            assertNotNull("No value for Name2", value);
            assertEquals("Incorrect value for Name2: " + value, "Jerry", value);
        } catch (final IllegalStateException e) {
            fail("Failed to initialize Log4j properly." + e.getMessage());
        }
View Full Code Here


            initializer.setLoggerContext();
            LoggerContext ctx = ContextAnchor.THREAD_CONTEXT.get();
            assertNotNull("No LoggerContext", ctx);
            Configuration config = ctx.getConfiguration();
            assertNotNull("No Configuration", config);
            StrSubstitutor substitutor = config.getStrSubstitutor();
            assertNotNull("No Interpolator", substitutor);
            String value = substitutor.replace("${web:initParam.TestParam}");
            assertNotNull("No value for TestParam", value);
            assertTrue("Incorrect value for TestParam: " + value, "ParamValue".equals(value));
            value = substitutor.replace("${web:attr.TestAttr}");
            assertNotNull("No value for TestAttr", value);
            assertTrue("Incorrect value for TestAttr: " + value, "AttrValue".equals(value));
            value = substitutor.replace("${web:Name1}");
            assertNotNull("No value for Name1", value);
            assertTrue("Incorrect value for Name1: " + value, "Ben".equals(value));
            value = substitutor.replace("${web:Name2}");
            assertNotNull("No value for Name2", value);
            assertTrue("Incorrect value for Name2: " + value, "Jerry".equals(value));
        } catch (final UnavailableException e) {
            fail("Failed to initialize Log4j properly." + e.getMessage());
        }
View Full Code Here

            LoggerContext ctx = ContextAnchor.THREAD_CONTEXT.get();
            assertNotNull("No LoggerContext", ctx);
            assertNotNull("No ServletContext", ctx.getExternalContext());
            Configuration config = ctx.getConfiguration();
            assertNotNull("No Configuration", config);
            StrSubstitutor substitutor = config.getStrSubstitutor();
            assertNotNull("No Interpolator", substitutor);
            String value = substitutor.replace("${web:initParam.TestParam}");
            assertNotNull("No value for TestParam", value);
            assertTrue("Incorrect value for TestParam: " + value, "ParamValue".equals(value));
            value = substitutor.replace("${web:attr.TestAttr}");
            assertNotNull("No value for TestAttr", value);
            assertTrue("Incorrect value for TestAttr: " + value, "AttrValue".equals(value));
            value = substitutor.replace("${web:Name1}");
            assertNotNull("No value for Name1", value);
            assertTrue("Incorrect value for Name1: " + value, "Ben".equals(value));
            value = substitutor.replace("${web:Name2}");
            assertNotNull("No value for Name2", value);
            assertTrue("Incorrect value for Name2: " + value, "Jerry".equals(value));
        } catch (final UnavailableException e) {
            fail("Failed to initialize Log4j properly." + e.getMessage());
        }
View Full Code Here

TOP

Related Classes of org.apache.logging.log4j.core.lookup.StrSubstitutor

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.