<div dir="ltr">The appender way is the easiest way but there are bunch of caveats to that method. We used to do it this way but needed more flexibility.<div><br></div><div>If you are going to do it the custom Appender way I recommend not using the MDC. You also can really only have pretty static attributes.</div><div><br></div><div>For example for Spring MVC we actually add the routing path to the MDC and thus the Appender would not be helpful. </div><div><br></div><div>Yeah you could make a unified thread local context that your custom appender uses but that is basically what the MDC is.</div><div><br></div><div>There is also the tricky biz of handing of dynamic MDC information to child threads. Again for example for every request we generate a uuid so that we can track that request and everything it executes.</div><div><br></div><div>But if your attributes are mainly static I agree that the custom appender is the route to go.... I feel stupid for not mentioning it first.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Mar 12, 2017 at 8:51 AM, David Tkaczyk <span dir="ltr"><<a href="mailto:davidtkaczyk69@gmail.com" target="_blank">davidtkaczyk69@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto">Extend your preferred appender.</div><div class="gmail_extra"><br><div class="gmail_quote">On Mar 12, 2017 6:59 AM, <<a href="mailto:logback-user-request@qos.ch" target="_blank">logback-user-request@qos.ch</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Send logback-user mailing list submissions to<br>
<a href="mailto:logback-user@qos.ch" target="_blank">logback-user@qos.ch</a><br>
<br>
To subscribe or unsubscribe via the World Wide Web, visit<br>
<a href="http://mailman.qos.ch/mailman/listinfo/logback-user" rel="noreferrer" target="_blank">http://mailman.qos.ch/mailman/<wbr>listinfo/logback-user</a><br>
or, via email, send a message with subject or body 'help' to<br>
<a href="mailto:logback-user-request@qos.ch" target="_blank">logback-user-request@qos.ch</a><br>
<br>
You can reach the person managing the list at<br>
<a href="mailto:logback-user-owner@qos.ch" target="_blank">logback-user-owner@qos.ch</a><br>
<br>
When replying, please edit your Subject line so it is more specific<br>
than "Re: Contents of logback-user digest..."<br>
<br>Today's Topics:<br>
<br>
1. Recommendations on including manifest implementation<br>
information into logging events (Andrew Feller)<br>
<br><br>---------- Forwarded message ----------<br>From: Andrew Feller <<a href="mailto:afeller@bandwidth.com" target="_blank">afeller@bandwidth.com</a>><br>To: <a href="mailto:logback-user@qos.ch" target="_blank">logback-user@qos.ch</a><br>Cc: <br>Bcc: <br>Date: Sat, 11 Mar 2017 14:59:35 -0500<br>Subject: [logback-user] Recommendations on including manifest implementation information into logging events<br><div dir="ltr">Does anyone have recommendations on how to best to add manifest implementation information (Implementation-Title, Implementation-Version, etc) to logback MDC trivially?<br clear="all"><div><br></div><div>I know this information can retrieved programmatically from a package (<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Package.html#getImplementationTitle--" target="_blank">Package.getImplementationTitl<wbr>e()</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Package.html#getImplementationVersion--" target="_blank">Package.getImplementationVersi<wbr>on()</a>, etc), but I'd rather avoid having every application hardcode logic on startup to determine this and stash it in MDC for later use. I would also like to avoid hard coding this information within logback.xml / logback-spring.xml as the manifest is the source of truth.</div><div><br></div><div>Any recommendations would be greatly appreciated!</div><div>-- <br></div><div class="m_-6889812013854380990m_-3846429331882705660gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><table style="font-size:12.8px;border:none;border-collapse:collapse"><tbody><tr style="height:167px"><td style="border:1px solid rgb(255,255,255);vertical-align:top;padding:7px"><p dir="ltr" style="line-height:1.44;margin-top:0pt;margin-bottom:0pt;margin-right:5pt"><font size="1"><span style="font-family:Arial;color:rgb(0,0,0);font-weight:700;vertical-align:baseline;white-space:pre-wrap;background-color:transparent"><img src="https://lh6.googleusercontent.com/WYeu84rijHA9DnlNpowhtHIkbXm-fNOEmMXbaM9QdZOpIs8fXg7mfWjQ44WzQz6JgcptFWq4MSjLu-CIhdcEU75IPR-FelHpEoMX7jU_h1S4hvD2TOOijrQlNW0Wts7MBstczHU" width="96" height="82" alt="email-signature-logo.jpg" style="border:none"></span></font></p></td><td style="border:1px solid rgb(255,255,255);vertical-align:top;padding:7px"><p dir="ltr" style="margin-top:0pt;margin-bottom:0pt"><font color="#676767" face="Calibri" size="2"><span style="line-height:14.08px;white-space:pre-wrap"><b>Andy Feller</b></span></font></p><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><font size="2"><span style="font-family:Calibri;color:rgb(132,139,148);font-style:italic;vertical-align:baseline;white-space:pre-wrap">Sr. DevOps Engineer<br></span><span style="font-family:Calibri;color:rgb(132,139,148);vertical-align:baseline;white-space:pre-wrap">900 Main Campus Drive, Suite 500</span></font></p><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><span style="font-family:Calibri;color:rgb(132,139,148);vertical-align:baseline;white-space:pre-wrap"><font size="2">Raleigh, NC 27606</font></span></p><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><font size="2"><span style="color:rgb(25,98,207);text-decoration:underline;font-family:Calibri;vertical-align:baseline;white-space:pre-wrap"><a href="http://www.bandwidth.com/" style="color:rgb(17,85,204);text-decoration:none" target="_blank">Bandwidth</a></span><a href="http://www.bandwidth.com/" target="_blank"><span style="color:rgb(103,103,103);text-decoration:none;font-family:Calibri;font-weight:700;vertical-align:baseline;white-space:pre-wrap"><br></span></a></font><span style="font-size:small;line-height:1.2;font-family:Calibri;color:rgb(103,103,103);font-weight:700;vertical-align:baseline;white-space:pre-wrap">e</span><span style="font-size:small;line-height:1.2;font-family:Calibri;color:rgb(128,128,128);vertical-align:baseline;white-space:pre-wrap"> </span><a href="mailto:afeller@bandwidth.com" style="font-size:small;line-height:1.2;color:rgb(17,85,204);text-decoration:none" target="_blank"><span style="font-family:Calibri;text-decoration:underline;vertical-align:baseline;white-space:pre-wrap">afeller@bandwidth.com</span></a></p></td></tr></tbody></table></div></div></div></div>
</div>
<br>______________________________<wbr>_________________<br>
logback-user mailing list<br>
<a href="mailto:logback-user@qos.ch" target="_blank">logback-user@qos.ch</a><br>
<a href="http://mailman.qos.ch/mailman/listinfo/logback-user" rel="noreferrer" target="_blank">http://mailman.qos.ch/mailman/<wbr>listinfo/logback-user</a><br></blockquote></div></div>
<br>______________________________<wbr>_________________<br>
logback-user mailing list<br>
<a href="mailto:logback-user@qos.ch">logback-user@qos.ch</a><br>
<a href="http://mailman.qos.ch/mailman/listinfo/logback-user" rel="noreferrer" target="_blank">http://mailman.qos.ch/mailman/<wbr>listinfo/logback-user</a><br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature">CTO<br>SnapHop (<a href="http://snaphop.com" target="_blank">snaphop.com</a>)<br>(twitter) @agentgt (linkedin) <a href="http://www.linkedin.com/in/agentgt" target="_blank">http://www.linkedin.com/in/agentgt</a> (cell) 781-883-5182 </div>
</div>