[logback-user] Custom Appender Configuration using generic Properties

John Page JohnPage at technotects.com
Thu Jul 28 17:12:38 UTC 2016


Hi,


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.


Instead of this:

<configuration>

    <appender name="theCustomAppender" class="domian.TheCustomAppender">

        <getterSetterProperty>value</getterSetterProperty>

    </appender>

</configuration>


I would like to write something like this:

<configuration>

    <appender name="theCustomAppender" class="domian.TheCustomAppender">

        <properties class="java.util.Properties">

            <property name="thisPropertyName" value="value" />

        </properties>

    </appender>

</configuration>


Does the Joran Configurator have the capability to parse a configuration file, generate a Properties object, and then hand it off to the Appender?
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.

The north-west wind does feel a bit chilly, right now... :-)


Thanks,
John Page
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.qos.ch/pipermail/logback-user/attachments/20160728/3f06b297/attachment.html>


More information about the logback-user mailing list