xml - How do I add multiple appenders to my Custom Appender using groovy config? -
I am converting my logback.xml file to groovy and with this challenge of adding the appenders to my custom appenders !
Currently I do this like this:
& Lt; Param name = "blocked" value = "true" /> & Lt; Epander-Reef Ref = "FILE" /> & Lt ;! - & lt; Epander-reef ref = "console" /> - & gt; & Lt; Epander-reef ref = "consol_arr" /> & Lt; / Appender & gt; I tried something like this, but it failed:
Appenders ("MyCustomAppender", MyCustomAppender) {buffer size = 10000 Blocking = true appendor-ref ('referee': "CONSOLE_ERR"); Appender- ref ('referee': "file"); } I can not change the custom appenders because it is in the shared code, so this is not the solution. I just want to do the exact thing that happens in XML, but in Jiroovi
Try it out: def consoleErrAppender = Appendix List.Fund { It - & gt; It.name == "CONSOLE_ERR"} def fileAppender = appenderList.find {it -> this. Name == "FILE"} The appender ("MyCustomAppender", MyCustomAppender) {Bufferism = 10000 blocked = true appenders = console ARRpadder apendure = fileappain} I think your MyCustomAppender implements the interface (or at least one public zero addAppender (Appendix & lt; E & gt; new appendix) method).
Comments
Post a Comment