On Wed, 2004-03-03 at 10:33, Ramakrishna Menon wrote:
Paul
Thanx a lot!
my requirements:
When a url is rendered, the entire rendering logic is done in a separate
thread (assume
one request = one separate thread). In the logic of rendering the url,
we have log4j messages being logged. I want to transparently "trap" those
messages
so that I can dump them on the url page itself based on a flag that I
specify in the url.
I would assume you mean "distinct" thread as opposed to "seperate"
thread? IE. for a given web request, you are saying only 1 thread
processes it. This is true 99% of the time unless your code calls on
something else that involves other threads and some rendevouzing, but
otherwise 99% of the time yes.
I think what your idea is to create one Appender per thread and then filter
out the log4j
messages for that thread, correct? That is an interesting one - I will get
back on how it goes.
Yes, the appender in my example gets initialised with a Filter that only
accepts LoggingEvents from the thread that created it.
Would be great to hear how you went with it.
cheers,
Paul