[logback-user] Log separation

Dhondt, Edwin edwin.dhondt at hp.com
Thu Apr 29 08:28:56 CEST 2010

Tools like Splunk are indeed an alternative. However if I have two apps deployed using a shared library (jar) that also contains log statements, I want those log statements to appear in webapp1's or webapp2's log files, depending on whether the common code was called in the context of webapp1 or 2. 

I want each of the webapps writing to a different file. That is, I don't want n applications writing to the same file.

-----Original Message-----
From: logback-user-bounces at qos.ch [mailto:logback-user-bounces at qos.ch] On Behalf Of Ralph Goers
Sent: donderdag 29 april 2010 2:15
To: logback users list
Subject: Re: [logback-user] Log separation
Importance: High

I find myself wondering if you really want what you say you do.  If you want to be able to view all the activity for a particular webapp a very practical way to do this is to use a tool like Splunk that can aggregate all the log data and then report based on filtering the data. Typically these tools are designed to take logs from various systems such as app servers, web servers, applications, etc. and correlate the data based on things like common a common session id value or other identifiers you put into your log records.  So instead of doing the segregation based on filters when the logs are written you do the segregation at the time you are viewing the logs. The advantage of this is that while what you are asking to do may work for a small number of servers it becomes terribly hard to do as you scale up. In addition, in my experience if you try to write to a single log file from 2 applications running on different servers you are likely to experience problems over time.


On Apr 28, 2010, at 7:56 AM, 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,
> _______________________________________________
> Logback-user mailing list
> Logback-user at qos.ch
> http://qos.ch/mailman/listinfo/logback-user

Logback-user mailing list
Logback-user at qos.ch

More information about the Logback-user mailing list