John,

Thanks for responding.

Where is the right place to initialize the log4j system, e.g. to call
Configurator? I'd like to install a FileAppender and WARN Priority at the
root, and let each servlet, ActionServlet,  override them if specified in
its initParameters. All Action and other classes registered with the servlet
should share same Appender and Priority. Should the root catagory be set at
the container startup? The sevlet init() seems the right place for
overriding the root. But I don't want to change either Tomcat or Struts
codes. Also, it probably mean I have to use some naming writing Actions.

Any suggestions?

Qiqi


----- Original Message -----
From: "John Carnahan" <[EMAIL PROTECTED]>
To: "LOG4J Users Mailing List" <[EMAIL PROTECTED]>
Sent: Sunday, February 18, 2001 11:35 AM
Subject: Re: Use log4j with struts


> Qiqi,
>
> The servlet side is pretty easy - as you likely already know. Use
> Servlet.getServletConfig().getServletContext().getInitParameter("foo").
> Then within the web-app config use <context-param foo='bar'/>. Then just
> initialize the log4j system at runtime. In this way you can use a
> different hierarchy for different virtual hosts. The problem here, of
> course, is that this would likely have to done on every run because
> servlet instances can be shared across web-apps and thus member
> variables would be a bad place to stuff cached config info. I have never
> tried it but this method should work although pretty inefficient.
>
> John
>
>
>
>
> Qiqi Dong wrote:
>
> > I want to use log4j with Struts/Tomcat and like all servlets in a
> > webapp to have same priority and log file. ALso, the priority and log
> > file should be set and changed with servlet's initial parameters. Any
> > idea from where should I start? Also, anyone has examples to use
> > different hierarchy for multi virtual hosts?
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to