[prev in list] [next in list] [prev in thread] [next in thread] 

List:       log4j-user
Subject:    Re: Different log files for different Servlet in same JVM
From:       "SCOTT FARQUHAR" <SCOTT.FARQUHAR () sydneywater ! com ! au>
Date:       2001-05-30 6:51:33
[Download RAW message or body]

The way I do it is pass the context path of the request to the category.

As in:

Category log = Category.getInstance(Utility.getDottedWeb(request.getServletPath()));

Utility.getDottedWeb turns "/" into ".", so then you can log per directory (ie each \
directory is a parent category to the servlet).

I also add a prefix so that it meshes nicely with the classes that I am logging.

Hope this helps
Scott

> > > etheroude@imediation.com 05/30/01 01:50am >>>
Hi,

I would like to log in different files for the different servlet name that I
have in the same JVM.

I try to do it with the use of NDC and Filter on the Appender, I filter on
the NDC name.
I push the NDC in the begin of the management of the request and pop at the
end.

But the NDC is based on the current thread, and the NDC is not set if a new
thread is created or used between the push and the pop. So, log generated at
this time can be link to any Servlet name or NDC. 

Is there anybody who try to do the samething ? Do you have any idea how to
do that ?
The same class can be used in different servlet context with the same log
category.


Thanks.

Eric.




-----------------------------------------------------------
This e-mail is solely for the use of the intended recepient
and may contain information which is confidential or
privileged. Unauthorised use of its contents is prohibited.
If you have received this e-mail in error, please notify 
the sender immediately via e-mail and then delete the 
original e-mail.
-----------------------------------------------------------

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: log4j-user-help@jakarta.apache.org


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic