Nested Components in appender definition

Hi, I'm writing a custom appender that has a configuration similar to: <appender name = "myAppender" class = "com.my.Appender"> <config class="com.my.Config"> <capacity>128</capacity> </config> </appender> When I test it, I have the following error: 20:19:40,527 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@41:32 - no applicable action for [capacity], current ElementPath is [[configuration][appender][config][capacity]] So config is properly handled whereas nested properties are not, how can I enable it? Thank you, Luca

Your appender needs to implement setConfig, and your config must implement setCapacity. On Sun, Aug 24, 2014 at 1:24 PM, lb <lburgazzoli@gmail.com> wrote:
Hi, I'm writing a custom appender that has a configuration similar to:
<appender name = "myAppender" class = "com.my.Appender"> <config class="com.my.Config"> <capacity>128</capacity> </config> </appender>
When I test it, I have the following error:
20:19:40,527 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@41:32 - no applicable action for [capacity], current ElementPath is [[configuration][appender][config][capacity]]
So config is properly handled whereas nested properties are not, how can I enable it?
Thank you, Luca
_______________________________________________ Logback-user mailing list Logback-user@qos.ch http://mailman.qos.ch/mailman/listinfo/logback-user

Both are implemented but only setConfig works. If I remove the capacity tag the error is not shown. On Sunday, August 24, 2014, Tony Trinh <tony19@gmail.com> wrote:
Your appender needs to implement setConfig, and your config must implement setCapacity.
On Sun, Aug 24, 2014 at 1:24 PM, lb <lburgazzoli@gmail.com <javascript:_e(%7B%7D,'cvml','lburgazzoli@gmail.com');>> wrote:
Hi, I'm writing a custom appender that has a configuration similar to:
<appender name = "myAppender" class = "com.my.Appender"> <config class="com.my.Config"> <capacity>128</capacity> </config> </appender>
When I test it, I have the following error:
20:19:40,527 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@41:32 - no applicable action for [capacity], current ElementPath is [[configuration][appender][config][capacity]]
So config is properly handled whereas nested properties are not, how can I enable it?
Thank you, Luca
_______________________________________________ Logback-user mailing list Logback-user@qos.ch <javascript:_e(%7B%7D,'cvml','Logback-user@qos.ch');> http://mailman.qos.ch/mailman/listinfo/logback-user

Tough to say without seeing your code. See the following working sample: https://github.com/tony19/logback-examples/tree/sandbox/logback/custom-appen... On Sun, Aug 24, 2014 at 4:23 PM, lb <lburgazzoli@gmail.com> wrote:
Both are implemented but only setConfig works. If I remove the capacity tag the error is not shown.
On Sunday, August 24, 2014, Tony Trinh <tony19@gmail.com> wrote:
Your appender needs to implement setConfig, and your config must implement setCapacity.
On Sun, Aug 24, 2014 at 1:24 PM, lb <lburgazzoli@gmail.com> wrote:
Hi, I'm writing a custom appender that has a configuration similar to:
<appender name = "myAppender" class = "com.my.Appender"> <config class="com.my.Config"> <capacity>128</capacity> </config> </appender>
When I test it, I have the following error:
20:19:40,527 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@41:32 - no applicable action for [capacity], current ElementPath is [[configuration][appender][config][capacity]]
So config is properly handled whereas nested properties are not, how can I enable it?
Thank you, Luca
_______________________________________________ Logback-user mailing list Logback-user@qos.ch http://mailman.qos.ch/mailman/listinfo/logback-user
_______________________________________________ Logback-user mailing list Logback-user@qos.ch http://mailman.qos.ch/mailman/listinfo/logback-user

The code is hosted in https://github.com/lburgazzoli/Chronicle-Logger/tree/HFT-CLOG-12 and the logback configuration is this one: https://github.com/lburgazzoli/Chronicle-Logger/blob/HFT-CLOG-12/logger-logb... The config class has the following property accessors: public void setIndexFileCapacity(int indexFileCapacity) { config.indexFileCapacity(indexFileCapacity); } public int getIndexFileCapacity() { return config.indexFileCapacity(); } And the xml: <appender name = "CONFIG-INDEXED-CHRONICLE" class = "net.openhft.chronicle.logger.logback.BinaryIndexedChronicleAppender"> <path>${java.io.tmpdir}/chronology-logback/config-indexed-chronicle</path> <formatMessage>false</formatMessage> <includeCallerData>false</includeCallerData> <includeMappedDiagnosticContext>false</includeMappedDiagnosticContext> <config class="net.openhft.chronicle.logger.IndexedLogAppenderConfig"> <indexFileCapacity>128</indexFileCapacity> </config> </appender> But I still see the following error: 13:10:57,943 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@41:32 - no applicable action for [indexFileCapacity], current ElementPath is [[configuration][appender][config][indexFileCapacity]] On Mon, Aug 25, 2014 at 12:56 AM, Tony Trinh <tony19@gmail.com> wrote:
Tough to say without seeing your code. See the following working sample:
https://github.com/tony19/logback-examples/tree/sandbox/logback/custom-appen...
On Sun, Aug 24, 2014 at 4:23 PM, lb <lburgazzoli@gmail.com> wrote:
Both are implemented but only setConfig works. If I remove the capacity tag the error is not shown.
On Sunday, August 24, 2014, Tony Trinh <tony19@gmail.com> wrote:
Your appender needs to implement setConfig, and your config must implement setCapacity.
On Sun, Aug 24, 2014 at 1:24 PM, lb <lburgazzoli@gmail.com> wrote:
Hi, I'm writing a custom appender that has a configuration similar to:
<appender name = "myAppender" class = "com.my.Appender"> <config class="com.my.Config"> <capacity>128</capacity> </config> </appender>
When I test it, I have the following error:
20:19:40,527 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@41:32 - no applicable action for [capacity], current ElementPath is [[configuration][appender][config][capacity]]
So config is properly handled whereas nested properties are not, how can I enable it?
Thank you, Luca
_______________________________________________ Logback-user mailing list Logback-user@qos.ch http://mailman.qos.ch/mailman/listinfo/logback-user
_______________________________________________ Logback-user mailing list Logback-user@qos.ch http://mailman.qos.ch/mailman/listinfo/logback-user
_______________________________________________ Logback-user mailing list Logback-user@qos.ch http://mailman.qos.ch/mailman/listinfo/logback-user

Hi Luca, The class net.openhft.chronicle.logger.IndexedLogAppenderConfig needs to exist. I am mentioning this as I could not find it in the repo you mentioned. -- Ceki On 25.08.2014 13:11, lb wrote:
The code is hosted in https://github.com/lburgazzoli/Chronicle-Logger/tree/HFT-CLOG-12 and the logback configuration is this one: https://github.com/lburgazzoli/Chronicle-Logger/blob/HFT-CLOG-12/logger-logb...
The config class has the following property accessors:
public void setIndexFileCapacity(int indexFileCapacity) { config.indexFileCapacity(indexFileCapacity); }
public int getIndexFileCapacity() { return config.indexFileCapacity(); }
And the xml:
<appender name = "CONFIG-INDEXED-CHRONICLE" class = "net.openhft.chronicle.logger.logback.BinaryIndexedChronicleAppender">
<path>${java.io.tmpdir}/chronology-logback/config-indexed-chronicle</path> <formatMessage>false</formatMessage> <includeCallerData>false</includeCallerData>
<includeMappedDiagnosticContext>false</includeMappedDiagnosticContext>
<config class="net.openhft.chronicle.logger.IndexedLogAppenderConfig"> <indexFileCapacity>128</indexFileCapacity> </config>
</appender>
But I still see the following error:
13:10:57,943 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@41:32 - no applicable action for [indexFileCapacity], current ElementPath is [[configuration][appender][config][indexFileCapacity]]
On Mon, Aug 25, 2014 at 12:56 AM, Tony Trinh <tony19@gmail.com <mailto:tony19@gmail.com>> wrote:
Tough to say without seeing your code. See the following working sample: https://github.com/tony19/logback-examples/tree/sandbox/logback/custom-appen...
On Sun, Aug 24, 2014 at 4:23 PM, lb <lburgazzoli@gmail.com <mailto:lburgazzoli@gmail.com>> wrote:
Both are implemented but only setConfig works. If I remove the capacity tag the error is not shown.
On Sunday, August 24, 2014, Tony Trinh <tony19@gmail.com <mailto:tony19@gmail.com>> wrote:
Your appender needs to implement setConfig, and your config must implement setCapacity.
On Sun, Aug 24, 2014 at 1:24 PM, lb <lburgazzoli@gmail.com> wrote:
Hi, I'm writing a custom appender that has a configuration similar to:
<appender name = "myAppender" class = "com.my.Appender"> <config class="com.my.Config"> <capacity>128</capacity> </config> </appender>
When I test it, I have the following error:
20:19:40,527 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@41:32 - no applicable action for [capacity], current ElementPath is [[configuration][appender][config][capacity]]
So config is properly handled whereas nested properties are not, how can I enable it?
Thank you, Luca
_______________________________________________ Logback-user mailing list Logback-user@qos.ch http://mailman.qos.ch/mailman/listinfo/logback-user
_______________________________________________ Logback-user mailing list Logback-user@qos.ch <mailto:Logback-user@qos.ch> http://mailman.qos.ch/mailman/listinfo/logback-user
_______________________________________________ Logback-user mailing list Logback-user@qos.ch <mailto:Logback-user@qos.ch> http://mailman.qos.ch/mailman/listinfo/logback-user
_______________________________________________ Logback-user mailing list Logback-user@qos.ch http://mailman.qos.ch/mailman/listinfo/logback-user
-- Ceki 65% of statistics are made up on the spot

Hi Ceki, It does exist https://github.com/lburgazzoli/Chronicle-Logger/blob/HFT-CLOG-12/logger/src/... it is not in the same sub-module as logback custom appender as it is shared On Monday, August 25, 2014, ceki <ceki@qos.ch> wrote:
Hi Luca,
The class net.openhft.chronicle.logger.IndexedLogAppenderConfig needs to exist. I am mentioning this as I could not find it in the repo you mentioned.
-- Ceki
On 25.08.2014 13:11, lb wrote:
The code is hosted in https://github.com/lburgazzoli/Chronicle-Logger/tree/HFT-CLOG-12 and the logback configuration is this one: https://github.com/lburgazzoli/Chronicle-Logger/blob/HFT-CLOG-12/logger- logback/src/test/resources/logback.xml
The config class has the following property accessors:
public void setIndexFileCapacity(int indexFileCapacity) { config.indexFileCapacity(indexFileCapacity); }
public int getIndexFileCapacity() { return config.indexFileCapacity(); }
And the xml:
<appender name = "CONFIG-INDEXED-CHRONICLE" class = "net.openhft.chronicle.logger.logback.BinaryIndexedChronicleAppender">
<path>${java.io.tmpdir}/chronology-logback/config- indexed-chronicle</path> <formatMessage>false</formatMessage> <includeCallerData>false</includeCallerData>
<includeMappedDiagnosticContext>false</includeMappedDiagnosticContext>
<config class="net.openhft.chronicle.logger.IndexedLogAppenderConfig"> <indexFileCapacity>128</indexFileCapacity> </config>
</appender>
But I still see the following error:
13:10:57,943 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@41:32 - no applicable action for [indexFileCapacity], current ElementPath is [[configuration][appender][config][indexFileCapacity]]
On Mon, Aug 25, 2014 at 12:56 AM, Tony Trinh <tony19@gmail.com <mailto:tony19@gmail.com>> wrote:
Tough to say without seeing your code. See the following working sample: https://github.com/tony19/logback-examples/tree/sandbox/ logback/custom-appender
On Sun, Aug 24, 2014 at 4:23 PM, lb <lburgazzoli@gmail.com <mailto:lburgazzoli@gmail.com>> wrote:
Both are implemented but only setConfig works. If I remove the capacity tag the error is not shown.
On Sunday, August 24, 2014, Tony Trinh <tony19@gmail.com <mailto:tony19@gmail.com>> wrote:
Your appender needs to implement setConfig, and your config must implement setCapacity.
On Sun, Aug 24, 2014 at 1:24 PM, lb <lburgazzoli@gmail.com> wrote:
Hi, I'm writing a custom appender that has a configuration similar to:
<appender name = "myAppender" class = "com.my.Appender"> <config class="com.my.Config"> <capacity>128</capacity> </config> </appender>
When I test it, I have the following error:
20:19:40,527 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@41:32 - no applicable action for [capacity], current ElementPath is [[configuration][appender][config][capacity]]
So config is properly handled whereas nested properties are not, how can I enable it?
Thank you, Luca
_______________________________________________ Logback-user mailing list Logback-user@qos.ch http://mailman.qos.ch/mailman/listinfo/logback-user
_______________________________________________ Logback-user mailing list Logback-user@qos.ch <mailto:Logback-user@qos.ch> http://mailman.qos.ch/mailman/listinfo/logback-user
_______________________________________________ Logback-user mailing list Logback-user@qos.ch <mailto:Logback-user@qos.ch> http://mailman.qos.ch/mailman/listinfo/logback-user
_______________________________________________ Logback-user mailing list Logback-user@qos.ch http://mailman.qos.ch/mailman/listinfo/logback-user
-- Ceki 65% of statistics are made up on the spot _______________________________________________ Logback-user mailing list Logback-user@qos.ch http://mailman.qos.ch/mailman/listinfo/logback-user

Can you please post *all* the output generated by the following configuration file? <configuration debug="true"> <appender name = "X" class = "net.openhft.chronicle.logger.logback.BinaryIndexedChronicleAppender"> <path>x</path> <config class="net.openhft.chronicle.logger.IndexedLogAppenderConfig"> <indexFileCapacity>128</indexFileCapacity> </config> </appender> </configuration> On 25.08.2014 21:48, lb wrote:
Hi Ceki,
It does exist https://github.com/lburgazzoli/Chronicle-Logger/blob/HFT-CLOG-12/logger/src/... it is not in the same sub-module as logback custom appender as it is shared
-- Ceki 65% of statistics are made up on the spot

BinaryIndexedChronicleAppender's setConfig method is using generics (in AbstractChronicleAppender<C>.setConfig(C config)), which is affected by Java's type erasure [1][2][3]. To workaround this, override setConfig with the desired type. public class BinaryIndexedChronicleAppender extends BinaryChronicleAppender<IndexedLogAppenderConfig> { // ... @Override public void setConfig(IndexedLogAppenderConfig config) { super.setConfig(config); } } [1] http://docs.oracle.com/javase/tutorial/java/generics/erasure.html [2] http://docs.oracle.com/javase/tutorial/java/generics/bridgeMethods.html [3] http://codereligion.com/beware-of-java-beans-introspector/

Hi Tony, your hint did solve my problem, thank you very much. Luca On Tue, Aug 26, 2014 at 4:58 AM, Tony Trinh <tony19@gmail.com> wrote:
BinaryIndexedChronicleAppender's setConfig method is using generics (in AbstractChronicleAppender<C>.setConfig(C config)), which is affected by Java's type erasure [1][2][3]. To workaround this, override setConfig with the desired type.
public class BinaryIndexedChronicleAppender extends BinaryChronicleAppender<IndexedLogAppenderConfig> { // ...
@Override public void setConfig(IndexedLogAppenderConfig config) { super.setConfig(config); } }
[1] http://docs.oracle.com/javase/tutorial/java/generics/erasure.html [2] http://docs.oracle.com/javase/tutorial/java/generics/bridgeMethods.html [3] http://codereligion.com/beware-of-java-beans-introspector/
_______________________________________________ Logback-user mailing list Logback-user@qos.ch http://mailman.qos.ch/mailman/listinfo/logback-user
participants (3)
-
ceki
-
lb
-
Tony Trinh