I've just finished reading that chapter.

At first glance it seems that using a combination of 
JNDIBasedContextDiscriminator and SiftingAppender should solve my problem ?

But then I read on through the example (Yoda, Kenobi) and now I'm confused.  
Especially because of the following sentence from the example "Note that even 
if the ch.qos.starwars.shared.Mustafar logger outputs to kenobi.log it is still 
attached to 'yoda'. Thus, we have two distinct logging contexts logging to the 
same file, in this case kenobi.log. Each of these contexts reference 
FileAppender instances, nested within distinct SiftingAppender instances, 
logging to the same file."
So although the solution described (JNDIBasedContextDiscriminator and 
SiftingAppender) is about how to log to different files from within a shared 
codebase, the example doesn't seem to support that theory because it says that 
two distinct logging contexts are logging to the same file. Is the example 
wrong ? What am I missing ?

Edwin

-----Original Message-----
From: [email protected] [mailto:[email protected]] On 
Behalf Of Ceki Gülcü
Sent: woensdag 28 april 2010 17:28
To: logback users list
Subject: Re: [logback-user] Log separation

Hello Edwin,

The chapter on logging separation [1] should be helpful, in particular
the section entitled "Taming static references in shared libraries".

HTH,

[1] http://logback.qos.ch/manual/loggingSeparation.html

On 28/04/2010 4:56 PM, Dhondt, Edwin wrote:
> I've got 4 web applications.  They all have some specific code containing log 
> statements but they also include a common "backend" codebase jar. Code in 
> that common codebase also contains log statements.
>
> I want each of those 4 applications to have their own log file.  That is, I 
> want all log messages for webapp 1 to appear in webapp 1's log file, messages 
> for webapp2 in webapp 2's file and so on.
>
> This is not a problem for the log statements appearing in the code specific 
> to each webapp.
>
> But what about log statements in de common "backend" codebase (included by 
> each of the webapps) ?  How do those log statements "know" when log 
> statements should go to webapp 1's logfile or webapp 2's log file ?  Because 
> that depends on where the calling  thread initiated (in webapp1, 2, ...).
> I could augment each of my backend method signatures with a extra context 
> parameter, but I hope there are more transparent solutions ?
>
> User =>  methodA Webapp1 =>  backend codebase methodX =>  webapp1.log
> User =>  methodB Webapp2 =>  backend codebase methodX =>  webapp2.log
> ...
>
> Any advice would be welcome.
> Thanks,
> EDH
>
_______________________________________________
Logback-user mailing list
[email protected]
http://qos.ch/mailman/listinfo/logback-user

_______________________________________________
Logback-user mailing list
[email protected]
http://qos.ch/mailman/listinfo/logback-user

Reply via email to