[logback-user] Log separation

Ceki Gülcü ceki at qos.ch
Thu Apr 29 10:11:08 CEST 2010

On 29/04/2010 2:14 AM, Ralph Goers wrote:

 > 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.

That's indeed an alternative solution.

 > 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.

You may have a point in that the solution described in [1] fairly
complex. As for performance, the cost of a JNDI lookup per logger
retrieval can be high but which can be dramatically reduced with the
help of LoggerContextFilter. As for contention writing to the same
file from different contexts, while this does not scale when the
number of writers increases, in this case contention is independent of
the number of web-apps and actually remains *constant*.  For example, if
you have web-apps W0, W1, ..., Wn and W0 is started first so that the
loggers of the shared library are attached to W0, then *only*
appenders in W0 will contend with appenders in the other web-apps. For
example, appenders in W2 and W3 will never contend. More generally,
for i and j different than 0, appenders in Wi and Wj will never

So while I agree that the approach described in [1] is not easy to
grasp, I don't think it suffers from scalability problems.

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

> Ralph

More information about the Logback-user mailing list