Hi all,

 

I have the following situation:

I have log statements which are marked in any way (f.i. the MDC contains a special entry "id=47") and in addition there are log statements without a mark. Now I want to split the marked statements into files using the SiftingAppender, for example, resulting in files like "foo-47.log, foo-0815.log". But in addition I want to add every unmarked statement to all files.

 

The result should be something like

foo-47.log

"…

01.01.2013 12:00:00.000 [47] This is a log entry for ID 47

01.01.2013 12:00:00.002 [] This is a log entry for all IDs

…"

 

foo-0815.log

"…

01.01.2013 12:00:00.001 [0815] This is a log entry for ID 0815

01.01.2013 12:00:00.002 [] This is a log entry for all IDs

…"

 

So the point is to select one appender using the discriminating value or all appenders in case of the default value.

 

As I haven't found a standard solution my idea is to subclass the SiftingAppender and

-          add methods to register/deregister values which are used in case of the discriminator returning the default value

-          add handling for more than one appender

 

Are there any concerns about that? F.i, is the logging event changed in a way that it can't be reused?

 

There may be some problems, because the SiftingAppenderBase contains some package-private code and the code for retrieving the discriminator value and finding the appender is within one method, referencing package-private variables.

 

Any ideas, comments, pitfalls?

 

Thanks in advance

Johannes




Firma: Capgemini Deutschland GmbH
Geschäftsführer: Dr. Michael Schulte (Sprecher) • Dr. Uwe Dumslaff • Josef Ranner
Aufsichtsratsvorsitzender: Antonio Schnieder
Amtsgericht Berlin-Charlottenburg, HRB 98814
This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to read, print, retain, copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message.