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.
|
- Use log4j with struts Qiqi Dong
- Re: Use log4j with struts John Carnahan
- Re: Use log4j with struts Qiqi Dong
- Michael Brennan