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 Re: Create multiple appenders objects
Date Thu, 11 Oct 2007 23:46:52 GMT
Sure... I forgot to write it in the code.
But... It's still not working.

[OT]
And in fact, I can't use a config file because the real code is to
load Spring configuration files and handle with a web application
creating differents paths dynamically according to request parameters.
But my "only" problem is how to use the log4j API to create those
appenders. In my application the API is changed to beans
configuration.

Julio

On 10/11/07, James A. N. Stauffer <stauffer.james@gmail.com> wrote:
> When creating appenders programatically you need to do something like
> calling activateOptions().  You will probably find that using a config
> file works much better.
>
> On 10/11/07, Julio S. G. <juliosg@gmail.com> wrote:
> > 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
> >
> >
>
>
> --
> James A. N. Stauffer        http://www.geocities.com/stauffer_james/
> Are you good? Take the test at http://www.livingwaters.com/good/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>
>

---------------------------------------------------------------------
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