[logback-user] Log separation

Ralph Goers rgoers at apache.org
Thu Apr 29 02:14:32 CEST 2010


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.

Ralph

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,
> EDH
> 
> 
> _______________________________________________
> Logback-user mailing list
> Logback-user at qos.ch
> http://qos.ch/mailman/listinfo/logback-user



More information about the Logback-user mailing list