Our nice example "Programmatically Modifying the Current Configuration
after Initialization" does not work. (The PatternLayout.create() call does
not compile too).

I've simplified it to:

    @Test
    public void test() {
        final LoggerContext ctx = (LoggerContext)
LogManager.getContext(false);
        final Configuration config = ctx.getConfiguration();
        Layout<?> layout = PatternLayout.createDefaultLayout();
        Appender appender = FileAppender.createAppender("target/test.log",
"false", "false", "File", "true", "false",
                "false", "4000", layout, null, "false", null, config);
        appender.start();
        config.addAppender(appender);
        ctx.updateLoggers();
        LogManager.getLogger().error("FOO MSG");
    }

and it creates an empty file.

What am I missing? The test class has nothing else in it.

Gary

-- 
E-Mail: [email protected] | [email protected]
Java Persistence with Hibernate, Second Edition
<http://www.manning.com/bauer3/>
JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
Spring Batch in Action <http://www.manning.com/templier/>
Blog: http://garygregory.wordpress.com
Home: http://garygregory.com/
Tweet! http://twitter.com/GaryGregory

Reply via email to