<div dir="ltr">Thanks for the feedback David, Adam!  I actually am outfitting a variety of Java apps with the logstash-logback-encoder for storing logs in ELK / Elasticstack and was aiming to store implementation info in MDC so it would be available.<div><br></div><div>Aside from the suggestions both of you offered, I had only 2 other ideas:</div><div><ol><li>Have logback read maven-generated pom.properties under META-INF for version, artifactId, groupId</li><li>Create a custom context listener as described in <a href="http://stackoverflow.com/questions/1975939/read-environment-variables-from-logback-configuration-file/23969706#23969706">StackOverflow question</a> that would figure out the main class and lookup it's implementation info</li></ol><div><div><div class="gmail_extra">Customizing the appender seems weird since it's concern is persisting log events to an external system (ELK, file, syslog, etc).</div><div class="gmail_extra"> <br><div class="gmail_quote">On Sun, Mar 12, 2017 at 11:05 AM,  <span dir="ltr"><<a href="mailto:logback-user-request@qos.ch" target="_blank">logback-user-request@qos.ch</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
Date: Sun, 12 Mar 2017 11:04:39 -0400<br>
From: Adam Gent <<a href="mailto:adam.gent@snaphop.com">adam.gent@snaphop.com</a>><br>
To: logback users list <<a href="mailto:logback-user@qos.ch">logback-user@qos.ch</a>><br>
Subject: Re: [logback-user] Manifest Question<br>
Message-ID:<br>
        <CAG4f71u9ye=<a href="mailto:Uog0n5wUY-J3tDjdg6Tw67LoOVN8A6ODMxMy7eA@mail.gmail.com">Uog0n5wUY-<wbr>J3tDjdg6Tw67LoOVN8A6ODMxMy7eA@<wbr>mail.gmail.com</a>><br>
Content-Type: text/plain; charset="utf-8"<br>
<br>
The appender way is the easiest way but there are bunch of caveats to that<br>
method. We used to do it this way but needed more flexibility.<br>
<br>
If you are going to do it the custom Appender way I recommend not using the<br>
MDC. You also can really only have pretty static attributes.<br>
<br>
For example for Spring MVC we actually add the routing path to the MDC and<br>
thus the Appender would not be helpful.<br>
<br>
Yeah you could make a unified thread local context that your custom<br>
appender uses but that is basically what the MDC is.<br>
<br>
There is also the tricky biz of handing of dynamic MDC information to child<br>
threads. Again for example for every request we generate a uuid so that we<br>
can track that request and everything it executes.<br>
<br>
But if your attributes are mainly static I agree that the custom appender<br>
is the route to go.... I feel stupid for not mentioning it first.<br>
<br>
On Sun, Mar 12, 2017 at 8:51 AM, David Tkaczyk <<a href="mailto:davidtkaczyk69@gmail.com">davidtkaczyk69@gmail.com</a>><br>
wrote:<br>
<br>
> Extend your preferred appender.<br>
><br>
> On Mar 12, 2017 6:59 AM, <<a href="mailto:logback-user-request@qos.ch">logback-user-request@qos.ch</a>> wrote:<br>
><br>
>> Send logback-user mailing list submissions to<br>
>>         <a href="mailto:logback-user@qos.ch">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">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">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">afeller@bandwidth.com</a>><br>
>> To: <a href="mailto:logback-user@qos.ch">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<br>
>> implementation information into logging events<br>
>> Does anyone have recommendations on how to best to add manifest<br>
>> implementation information (Implementation-Title, Implementation-Version,<br>
>> etc) to logback MDC trivially?<br>
>><br>
>> I know this information can retrieved programmatically from a package (<br>
>> Package.<wbr>getImplementationTitle()<br>
>> <<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Package.html#getImplementationTitle--" rel="noreferrer" target="_blank">https://docs.oracle.com/<wbr>javase/8/docs/api/java/lang/<wbr>Package.html#<wbr>getImplementationTitle--</a>>,<br>
>> Package.<wbr>getImplementationVersion()<br>
>> <<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Package.html#getImplementationVersion--" rel="noreferrer" target="_blank">https://docs.oracle.com/<wbr>javase/8/docs/api/java/lang/<wbr>Package.html#<wbr>getImplementationVersion--</a>>,<br>
>> etc), but I'd rather avoid having every application hardcode logic on<br>
>> startup to determine this and stash it in MDC for later use.  I would also<br>
>> like to avoid hard coding this information within logback.xml /<br>
>> logback-spring.xml as the manifest is the source of truth.<br>
>><br>
>> Any recommendations would be greatly appreciated!<br>
>> --<br>
>><br>
>> [image: email-signature-logo.jpg]<br>
>><br>
>> *Andy Feller*<br>
>><br>
>> Sr. DevOps Engineer<br>
>> 900 Main Campus Drive, Suite 500<br>
>><br>
>> Raleigh, NC 27606<br>
>><br>
>> Bandwidth <<a href="http://www.bandwidth.com/" rel="noreferrer" target="_blank">http://www.bandwidth.com/</a>><br>
>> <<a href="http://www.bandwidth.com/" rel="noreferrer" target="_blank">http://www.bandwidth.com/</a>>e <a href="mailto:afeller@bandwidth.com">afeller@bandwidth.com</a><br>
>><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>
>><br>
><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>
><br>
<br>
<br>
<br>
--<br>
CTO<br>
SnapHop (<a href="http://snaphop.com" rel="noreferrer" target="_blank">snaphop.com</a>)<br>
(twitter) @agentgt (linkedin) <a href="http://www.linkedin.com/in/agentgt" rel="noreferrer" target="_blank">http://www.linkedin.com/in/<wbr>agentgt</a> (cell)<br>
<a href="tel:781-883-5182" value="+17818835182">781-883-5182</a><br>
-------------- next part --------------<br>
An HTML attachment was scrubbed...<br>
URL: <<a href="http://mailman.qos.ch/pipermail/logback-user/attachments/20170312/7204c9d0/attachment.html" rel="noreferrer" target="_blank">http://mailman.qos.ch/<wbr>pipermail/logback-user/<wbr>attachments/20170312/7204c9d0/<wbr>attachment.html</a>><br>
<br>
------------------------------<br>
<br>
Subject: Digest Footer<br>
<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>
<br>
------------------------------<br>
<br>
End of logback-user Digest, Vol 66, Issue 2<br>
******************************<wbr>*************<br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_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></div></div></div></div>