<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;background-color:#FFFFFF;font-family:Calibri,Arial,Helvetica,sans-serif;">
<p>Shortly after writing to this list, I hit on one solution. </p>
<p>If the Custom Appender is configured as described below :</p>
<p><span style="font-family: Calibri, Arial, Helvetica, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols; font-size: 16px;">- - - - - - - - - - </span><span style="font-family: Calibri, Arial, Helvetica, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols; font-size: 16px;">-
- - - - - - - - - </span><span style="font-family: Calibri, Arial, Helvetica, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols; font-size: 16px;">- - - - - - - - - - </span><span style="font-family: Calibri, Arial, Helvetica, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols; font-size: 16px;">-
- - - - - - - - - </span></p>
<p></p>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; margin-top: 0px; margin-bottom: 0px;">
<font face="Calibri,Arial,Helvetica,sans-serif" size="2"><span style="font-size: 16px;"><configuration></span></font></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; margin-top: 0px; margin-bottom: 0px;">
<font face="Calibri,Arial,Helvetica,sans-serif" size="2"><span style="font-size: 16px;"> <appender name="theCustomAppender" class="domain.TheCustomAppender"></span></font></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; margin-top: 0px; margin-bottom: 0px;">
<font face="Calibri,Arial,Helvetica,sans-serif" size="2"><span style="font-size: 16px;"> <properties></span></font></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; margin-top: 0px; margin-bottom: 0px;">
<font face="Calibri,Arial,Helvetica,sans-serif" size="2"><span style="font-size: 16px;"> propertyName1=propertyValue1</span></font></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; margin-top: 0px; margin-bottom: 0px;">
<font face="Calibri,Arial,Helvetica,sans-serif" size="2"><span style="font-size: 16px;"> <span style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px;">propertyName2=propertyValue2</span></span></font></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; margin-top: 0px; margin-bottom: 0px;">
<font face="Calibri,Arial,Helvetica,sans-serif" size="2"><span style="font-size: 16px;"> </<font face="Calibri,Arial,Helvetica,sans-serif">properties</font>></span></font></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; margin-top: 0px; margin-bottom: 0px;">
<font face="Calibri,Arial,Helvetica,sans-serif" size="2"><span style="font-size: 16px;"> </appender></span></font></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; margin-top: 0px; margin-bottom: 0px;">
<font face="Calibri,Arial,Helvetica,sans-serif" size="2"><span style="font-size: 16px;"></configuration></span></font></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; margin-top: 0px; margin-bottom: 0px;">
<font face="Calibri,Arial,Helvetica,sans-serif" size="2"><span style="font-size: 16px;"><span style="font-family: Calibri, Arial, Helvetica, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols; font-size: 16px;">-
- - - - - - - - - </span><span style="font-family: Calibri, Arial, Helvetica, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols; font-size: 16px;">- - - - - - - - - - </span><span style="font-family: Calibri, Arial, Helvetica, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols; font-size: 16px;">-
- - - - - - - - - </span><span style="font-family: Calibri, Arial, Helvetica, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols; font-size: 16px;">- - - - - - - - - - </span><br>
</span></font></div>
<p></p>
<p><br>
</p>
<p>Add a "Properties" getter and setter which uses a String argument.</p>
<p><span style="font-family: Calibri, Arial, Helvetica, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols; font-size: 16px;">- - - - - - - - - - </span><span style="font-family: Calibri, Arial, Helvetica, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols; font-size: 16px;">-
- - - - - - - - - </span><span style="font-family: Calibri, Arial, Helvetica, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols; font-size: 16px;">- - - - - - - - - - </span><span style="font-family: Calibri, Arial, Helvetica, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols; font-size: 16px;">-
- - - - - - - - - </span><br>
</p>
<p>public String getProperties()</p>
<p>public setProperties(String propertiesString)</p>
<p><span style="font-family: Calibri, Arial, Helvetica, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols; font-size: 16px;">- - - - - - - - - - </span><span style="font-family: Calibri, Arial, Helvetica, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols; font-size: 16px;">-
- - - - - - - - - </span><span style="font-family: Calibri, Arial, Helvetica, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols; font-size: 16px;">- - - - - - - - - - </span><span style="font-family: Calibri, Arial, Helvetica, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols; font-size: 16px;">-
- - - - - - - - - </span><br>
</p>
<p><span style="font-family: Calibri, Arial, Helvetica, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols; font-size: 16px;"><br>
</span></p>
<p>When I need the Properties object, I simple do the following:</p>
<p></p>
<div><span style="font-family: Calibri, Arial, Helvetica, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols; font-size: 16px;">- - - - - - - - - - </span><span style="font-family: Calibri, Arial, Helvetica, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols; font-size: 16px;">-
- - - - - - - - - </span><span style="font-family: Calibri, Arial, Helvetica, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols; font-size: 16px;">- - - - - - - - - - </span><span style="font-family: Calibri, Arial, Helvetica, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols; font-size: 16px;">-
- - - - - - - - - </span><br>
</div>
<div>Properties properties = new Properties();</div>
<div><span style="font-size: 12pt;">properties.load(new StringReader(<span style="font-family: Calibri, Arial, Helvetica, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols; font-size: 16px;">propertiesString</span>));</span><br>
</div>
<span style="font-family: Calibri, Arial, Helvetica, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols; font-size: 16px;">- - - - - - - - - - </span><span style="font-family: Calibri, Arial, Helvetica, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols; font-size: 16px;">-
- - - - - - - - - </span><span style="font-family: Calibri, Arial, Helvetica, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols; font-size: 16px;">- - - - - - - - - - </span><span style="font-family: Calibri, Arial, Helvetica, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols; font-size: 16px;">-
- - - - - - - - - </span><br>
<p></p>
<p><span style="font-family: Calibri, Arial, Helvetica, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols; font-size: 16px;"><br>
</span></p>
<p>Problem solved. </p>
<p><br>
</p>
<p>Feel free to reply to this thread, with an alternate solution that makes use of a more Joran-oriented technique.</p>
<p><br>
</p>
<p>Thanks,</p>
<div id="Signature">
<div id="divtagdefaultwrapper" style="font-size:12pt; color:#000000; background-color:#FFFFFF; font-family:Calibri,Arial,Helvetica,sans-serif">
<div id="divtagdefaultwrapper" style="font-size:12pt; color:#000000; background-color:#FFFFFF; font-family:Calibri,Arial,Helvetica,sans-serif">
John Page</div>
<div id="divtagdefaultwrapper" style="font-size:12pt; color:#000000; background-color:#FFFFFF; font-family:Calibri,Arial,Helvetica,sans-serif">
</div>
<div id="divtagdefaultwrapper" style="font-size:12pt; color:#000000; background-color:#FFFFFF; font-family:Calibri,Arial,Helvetica,sans-serif">
</div>
</div>
</div>
</div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> John Page<br>
<b>Sent:</b> 28 July 2016 13:12:38<br>
<b>To:</b> logback-user@qos.ch<br>
<b>Subject:</b> Custom Appender Configuration using generic Properties</font>
<div> </div>
</div>
<div>
<div id="divtagdefaultwrapper" style="font-size:12pt; color:#000000; background-color:#FFFFFF; font-family:Calibri,Arial,Helvetica,sans-serif">
<div id="divtagdefaultwrapper" style="font-size:12pt; color:#000000; background-color:#FFFFFF; font-family:Calibri,Arial,Helvetica,sans-serif">
<p></p>
<p style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:16px">Hi,</p>
<p style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:16px"><br>
</p>
<p style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:16px">I have developed a custom appender for logback and would like to configure it with a generic set of Properties that I can pass on to the underlying libraries. Rather than create a Getter
and Setter for each property that the underlying library uses, I would like the configuration to read the *names* of the properties out of the logback configuration file.</p>
<p style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:16px"><br>
</p>
<p style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:16px">Instead of this:</p>
<p style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:16px"><configuration></p>
<p style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:16px"> <appender name="theCustomAppender" class="domian.TheCustomAppender"></p>
<p style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:16px"> <getterSetterProperty>value</<span style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:16px"><span style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:16px">getterSetter</span><span style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:16px">Property</span>></span></p>
<p style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:16px"> </appender></p>
<p style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:16px"></configuration></p>
<p style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:16px"><br>
</p>
<p style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:16px">I would like to write something like this:</p>
<p style="font-size:16px; font-family:Calibri,Arial,Helvetica,sans-serif"><configuration></p>
<p style="font-size:16px; font-family:Calibri,Arial,Helvetica,sans-serif"> <appender name="theCustomAppender" class="domian.TheCustomAppender"></p>
<p style="font-size:16px; font-family:Calibri,Arial,Helvetica,sans-serif"> <properties class="java.util.Properties"></p>
<p style="font-size:16px; font-family:Calibri,Arial,Helvetica,sans-serif"> <property name="thisPropertyName" value="value" /></p>
<p style="font-size:16px; font-family:Calibri,Arial,Helvetica,sans-serif"></p>
<p style="font-size:16px; font-family:Calibri,Arial,Helvetica,sans-serif"> </<span style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:16px">properties</span>></p>
<p style="font-size:16px; font-family:Calibri,Arial,Helvetica,sans-serif"> </appender></p>
<p style="font-size:16px; font-family:Calibri,Arial,Helvetica,sans-serif"></configuration></p>
<p style="font-size:16px; font-family:Calibri,Arial,Helvetica,sans-serif"><br>
</p>
Does the Joran Configurator have the capability to parse a configuration file, generate a Properties object, and then hand it off to the Appender?</div>
<div id="divtagdefaultwrapper" style="font-size:12pt; color:#000000; background-color:#FFFFFF; font-family:Calibri,Arial,Helvetica,sans-serif">
I have looked around and have not been able to identify any guidance for this use case. I have discovered the nested element capability and the "class" attribute, but have not been able to build a mapped structure. </div>
<div id="divtagdefaultwrapper" style="font-size:12pt; color:#000000; background-color:#FFFFFF; font-family:Calibri,Arial,Helvetica,sans-serif">
<br>
</div>
<div id="divtagdefaultwrapper" style="font-size:12pt; color:#000000; background-color:#FFFFFF; font-family:Calibri,Arial,Helvetica,sans-serif">
The north-west wind does feel a bit chilly, right now... :-)</div>
<div>
<div id="divtagdefaultwrapper" style="font-size:12pt; color:#000000; background-color:#FFFFFF; font-family:Calibri,Arial,Helvetica,sans-serif">
<p><br>
</p>
<div id="Signature">
<div id="divtagdefaultwrapper" style="font-size:12pt; color:#000000; background-color:#FFFFFF; font-family:Calibri,Arial,Helvetica,sans-serif">
<div id="divtagdefaultwrapper" style="font-size:12pt; color:#000000; background-color:#FFFFFF; font-family:Calibri,Arial,Helvetica,sans-serif">
Thanks,</div>
<div id="divtagdefaultwrapper" style="font-size:12pt; color:#000000; background-color:#FFFFFF; font-family:Calibri,Arial,Helvetica,sans-serif">
John Page</div>
<div id="divtagdefaultwrapper" style="font-size:12pt; color:#000000; background-color:#FFFFFF; font-family:Calibri,Arial,Helvetica,sans-serif">
</div>
<div id="divtagdefaultwrapper" style="font-size:12pt; color:#000000; background-color:#FFFFFF; font-family:Calibri,Arial,Helvetica,sans-serif">
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>