logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Julio S. G." <juli...@gmail.com>
Subject Create multiple appenders objects
Date Thu, 11 Oct 2007 23:28:01 GMT
Hi,

I'm trying to create several appenders and unfortunately it's not working.
To create the objects I'm using something like new
DailyRollingFileAppender() with corrects parameters. Then I create the
Logger using the appender name.
Finally, when I use the Logger object to write, it doesn't work.
I'll put the code here and if anyone could help me I really appreciate.

        Layout layout1 = new PatternLayout("%m%n");
        Layout layout2 = new PatternLayout("%m%n");
        DailyRollingFileAppender app1 = new
DailyRollingFileAppender(layout1, "/file1.log", "'.'yyyyMMddHH");
        DailyRollingFileAppender app2 = new
DailyRollingFileAppender(layout2, "/file2.log", "'.'yyyyMMddHH");
        app1.setThreshold(Level.DEBUG);
        app2.setThreshold(Level.DEBUG);
        app1.setName("APPENDER1");
        app2.setName("APPENDER2");
        Logger logger1 = Logger.getLogger(app1.getName());
        Logger logger2 = Logger.getLogger(app2.getName());
        logger1.info("TEST 1!!!");
        logger2.info("TEST 2!!!");


Thanks,

Julio

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Mime
View raw message