<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;
        mso-fareast-language:EN-US;}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
        {mso-style-priority:34;
        margin-top:0cm;
        margin-right:0cm;
        margin-bottom:0cm;
        margin-left:36.0pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;
        mso-fareast-language:EN-US;}
span.E-MailFormatvorlage17
        {mso-style-type:personal-compose;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri",sans-serif;
        mso-fareast-language:EN-US;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:70.85pt 70.85pt 2.0cm 70.85pt;}
div.WordSection1
        {page:WordSection1;}
/* List Definitions */
@list l0
        {mso-list-id:715860955;
        mso-list-type:hybrid;
        mso-list-template-ids:1977880824 134676495 134676505 134676507 134676495 134676505 134676507 134676495 134676505 134676507;}
@list l0:level1
        {mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l0:level2
        {mso-level-number-format:alpha-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l0:level3
        {mso-level-number-format:roman-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:right;
        text-indent:-9.0pt;}
@list l0:level4
        {mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l0:level5
        {mso-level-number-format:alpha-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l0:level6
        {mso-level-number-format:roman-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:right;
        text-indent:-9.0pt;}
@list l0:level7
        {mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l0:level8
        {mso-level-number-format:alpha-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l0:level9
        {mso-level-number-format:roman-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:right;
        text-indent:-9.0pt;}
ol
        {margin-bottom:0cm;}
ul
        {margin-bottom:0cm;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="DE-CH" link="#0563C1" vlink="#954F72" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal"><span lang="en-CH">Good afternoon<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="en-CH"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="en-CH">The documentation for SLF4J and Logback is very detailed
</span><span lang="en-CH" style="font-family:"Segoe UI Emoji",sans-serif">😊</span><span lang="en-CH">, but unfortunately it is still difficult to understand the various possibilities and mechanisms, so I have a question:<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="en-CH"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="en-CH">Is it possible to configure the logback FileAppender
<br>
so that it automatically / dynamically creates logfile names based on a string which the developer passes in e.g.
</span><span lang="en-CH" style="font-size:10.0pt;font-family:Consolas;color:blue">LOGGER.trace()</span><span lang="en-CH">?
<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="en-CH"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="en-CH">The background to the idea is as follows:<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="en-CH"><o:p> </o:p></span></p>
<ol style="margin-top:0cm" start="1" type="1">
<li class="MsoListParagraph" style="margin-left:0cm;mso-list:l0 level1 lfo1"><span lang="en-CH">The developer is programming a new module (e.g. a configuration manager)<br>
and he would like to have the log entries summarised in a separate log file.<br>
<br>
<o:p></o:p></span></li><li class="MsoListParagraph" style="margin-left:0cm;mso-list:l0 level1 lfo1"><span lang="en-CH">Therefore, he calls something like that:
</span><span lang="en-CH" style="font-size:10.0pt;font-family:Consolas;color:blue">LOGGER.trace(“<span style="background:yellow;mso-highlight:yellow">Config-Mgr</span>”, â€œMessage”)<br>
<br>
</span><span lang="en-CH"><o:p></o:p></span></li><li class="MsoListParagraph" style="margin-left:0cm;mso-list:l0 level1 lfo1"><span lang="en-CH">SLF4J / Logback automatically reads this string and create this Logfile:
</span><span lang="en-CH" style="font-size:10.0pt;font-family:Consolas;color:blue">AppLog-<span style="background:yellow;mso-highlight:yellow">Config-Mgr</span>.log</span><span lang="en-CH"><br>
<br>
<br>
<o:p></o:p></span></li><li class="MsoListParagraph" style="margin-left:0cm;mso-list:l0 level1 lfo1"><span lang="en-CH">The central element is that we do not have to modify logback.xml and create an appender for each Logfile.<br>
<br>
This means that if the user now calls e.g.: </span><span lang="en-CH" style="font-size:10.0pt;font-family:Consolas;color:blue">LOGGER.trace(“<span style="background:lime;mso-highlight:lime">User-Actionlog</span>”, â€œMessage”)<br>
</span><span lang="en-CH">then this new log file will created without having to modify logback.xml:</span><span lang="en-CH" style="font-size:10.0pt;font-family:Consolas"><br>
<span style="color:blue">AppLog-<span style="background:lime;mso-highlight:lime">User-Actionlog</span>.log</span></span><span lang="en-CH"><o:p></o:p></span></li></ol>
<p class="MsoListParagraph"><span lang="en-CH"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="en-CH"><br>
Thank you very much for any tips & tricks </span><span lang="en-CH" style="font-family:"Segoe UI Emoji",sans-serif">😊</span><span lang="en-CH"><br>
<br>
<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="en-CH">Thanks a lot, kind regards,<br>
Thomas<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="en-CH"><o:p> </o:p></span></p>
</div>
</body>
</html>