[logback-user] Log separation

Ceki Gülcü ceki at qos.ch
Wed Apr 28 17:27:33 CEST 2010


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 method =>  webapp2.log
> ...
>
> Any advice would be welcome.
> Thanks,
> EDH
>


More information about the Logback-user mailing list