[logback-user] Is grouped (deferred) log statements from same threads possible using logback?

Donald McLean dmclean62 at gmail.com
Thu Mar 7 19:32:54 CET 2013


This is a problem that I run into all the time. I'm thinking that it
would be easier to handle the problem with tools that read and parse
the log file after the fact - or use a database appender.

The number of debug entries on a particular thread is unconstrained
and this could cause logback to suffer from low memory or out of
memory problems trying to pre-sort them.

I've actually been working on a tool for this and have made some progress.

Donald

On Thu, Mar 7, 2013 at 1:21 PM, janolaveide at gmail.com
<janolaveide at gmail.com> wrote:
>
> I have read about the Mapped Diagnostic Context, and although useful, the
> log statements from different threads still appear interspersed in the
> output.
>
> What I would like is to have all log statements from a thread outout
> consecutively when that thread is done (and I know what and when "done" is)
>
> For example :
>
> Thread A starts at time T-Astart, performs logging at various points, and is
> done at T-Adone.
>
> Before A is done, at time T-Bstart (T-Adone < T-Bstart < T-Adone) another
> thread B starts processing, does the same kind of logging and finishes at
> T-Bdone.
>
> Now, I would like all logging statements from thread A to appear before the
> logging statements from Thread B, and not interspersed as the MDC examples I
> have seen. Is this kind of deferred, grouped logging possible with logback ?


More information about the Logback-user mailing list