I created a ServletLogAppender that keeps its config info in a static ThreadLocal variable. I then created a servlet base class for my servlets that sets the appropriate info in the ThreadLocal variable (via a static method on the appender) at the start of each service call, so that all logging that happens in that thread while servicing the servlet request gets handled according to the configuration of that servlet.
 
The appender is attached to the root category so that logging on any category goes through that appender.
 
I can't share the code, unfortunately, (it's owned by my employer) but its pretty straightforward and has worked for me so far.
-----Original Message-----
From: Qiqi Dong [mailto:[EMAIL PROTECTED]]
Sent: Saturday, February 17, 2001 12:52 PM
To: LOG4J Users Mailing List
Subject: Use log4j with struts

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?

Reply via email to