logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robert Burrell Donkin <RobertDon...@appleonline.net>
Subject Re: servlet log appender
Date Thu, 08 Mar 2001 23:16:00 GMT
Harry.Burdick@sybase.com wrote:

> I've just started using Log4j in Tomcat.  Using BasicConfigurator, all my
> Log4j messages stream to the Tomcat console.

which version of tomcat are you using? i use tomcat 4, and all my stdout
logging goes to catalina.out.

> How do I make them go to the log?

i'm a log4j newbie but the attached custom appender works for me.
if you want to use it, then one way is to call from you servlet passing in
the context

Category.getRoot().addAppender(new ContextLogAppender(context));

if you want to use layout x, you need to set it before adding the appender

ContextLogAppender app=new ContextLogAppender(context);
app.setLayout(x);
Category.getRoot().addAppender(app);

> Is there a servlet log appender that send trace commands to the
> ServletContext.log method or the GenericServlet.log method?
> Or is there some other way I should be doing this?

that's a question that i'd like to know the answer to as well!

- robert

Mime
View raw message