<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<style>
<!--
@font-face
{font-family:"Cambria Math"}
@font-face
{font-family:Calibri}
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif"}
a:link, span.MsoHyperlink
{color:blue;
text-decoration:underline}
a:visited, span.MsoHyperlinkFollowed
{color:purple;
text-decoration:underline}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
{margin-top:0cm;
margin-right:0cm;
margin-bottom:0cm;
margin-left:36.0pt;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif"}
span.E-MailFormatvorlage18
{font-family:"Calibri","sans-serif";
color:windowtext}
.MsoChpDefault
{font-size:10.0pt}
@page WordSection1
{margin:70.85pt 70.85pt 2.0cm 70.85pt}
div.WordSection1
{}
ol
{margin-bottom:0cm}
ul
{margin-bottom:0cm}
-->
</style>
</head>
<body lang="DE" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span lang="EN-US">Hi all, </span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US">I have the following situation: </span></p>
<p class="MsoNormal"><span lang="EN-US">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.</span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US">The result should be something like</span></p>
<p class="MsoNormal"><span lang="EN-US">foo-47.log</span></p>
<p class="MsoNormal"><span lang="EN-US">"…</span></p>
<p class="MsoNormal"><span lang="EN-US">01.01.2013 12:00:00.000 [47] This is a log entry for ID 47</span></p>
<p class="MsoNormal"><span lang="EN-US">01.01.2013 12:00:00.002 [] This is a log entry for all IDs</span></p>
<p class="MsoNormal"><span lang="EN-US">…"</span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US">foo-0815.log</span></p>
<p class="MsoNormal"><span lang="EN-US">"…</span></p>
<p class="MsoNormal"><span lang="EN-US">01.01.2013 12:00:00.001 [0815] This is a log entry for ID 0815</span></p>
<p class="MsoNormal"><span lang="EN-US">01.01.2013 12:00:00.002 [] This is a log entry for all IDs</span></p>
<p class="MsoNormal"><span lang="EN-US">…"</span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US">So the point is to select one appender using the discriminating value or all appenders in case of the default value.</span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US">As I haven't found a standard solution my idea is to subclass the SiftingAppender and
</span></p>
<p class="MsoListParagraph" style="text-indent:-18.0pt"><span lang="EN-US"><span style="">-<span style="font:7.0pt "Times New Roman"">
</span></span></span><span lang="EN-US">add methods to register/deregister values which are used in case of the discriminator returning the default value</span></p>
<p class="MsoListParagraph" style="text-indent:-18.0pt"><span lang="EN-US"><span style="">-<span style="font:7.0pt "Times New Roman"">
</span></span></span><span lang="EN-US">add handling for more than one appender</span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US">Are there any concerns about that? F.i, is the logging event changed in a way that it can't be reused?</span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US">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.</span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US">Any ideas, comments, pitfalls? </span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US">Thanks in advance</span></p>
<p class="MsoNormal"><span lang="EN-US">Johannes</span></p>
</div>
<br>
<hr>
<font face="Arial" color="Gray" size="1"><br>
Firma: Capgemini Deutschland GmbH<br>
Geschäftsführer: Dr. Michael Schulte (Sprecher) • Dr. Uwe Dumslaff • Josef Ranner<br>
Aufsichtsratsvorsitzender: Antonio Schnieder<br>
Amtsgericht Berlin-Charlottenburg, HRB 98814<br>
</font>
<span style="font-size: 9px; line-height: 10px;">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.</span></body>
</html>