<html><head></head><body><div class="ydpd37b64dyahoo-style-wrap" style="font-family:Helvetica Neue, Helvetica, Arial, sans-serif;font-size:13px;" dir="ltr" data-setdir="false"><div></div>
        <div dir="ltr" data-setdir="false">Works on my machine: <a href="https://github.com/yihtserns/test-logback-appender-custom" rel="nofollow" target="_blank" class="">https://github.com/yihtserns/test-logback-appender-custom</a></div><div><br></div><div><br></div><div dir="ltr" data-setdir="false">When running the Main class in IDE:<br><div>```</div><div dir="ltr" data-setdir="false"><div>17:06:45: Executing task ':Main.main()'...<br><br>> Task :generateEffectiveLombokConfig<br>> Task :compileJava<br>> Task :processResources<br>> Task :classes<br><br>> Task :Main.main()<br>17:06:48,383 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback-test.xml]<br>17:06:48,384 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Found resource [logback.xml] at [file:/C:/workspace/projects/test-logback-appender-custom/build/resources/main/logback.xml]<br>17:06:48,464 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [com.github.yihtserns.test.logback.appender.custom.CatAppender]<br>17:06:48,466 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [cat]<br>17:06:48,466 |-INFO in ch.qos.logback.classic.joran.action.RootLoggerAction - Setting level of ROOT logger to INFO<br>17:06:48,466 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [cat] to Logger[ROOT]<br>17:06:48,467 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - End of configuration.<br>17:06:48,468 |-INFO in ch.qos.logback.classic.joran.JoranConfigurator@61e4705b - Registering current configuration as safe fallback point<br>Meow: Hello</div></div><div>```<br></div></div><div dir="ltr" data-setdir="false"><br></div><div><br></div>
        
        </div><div id="ydpf596612byahoo_quoted_9626682023" class="ydpf596612byahoo_quoted">
            <div style="font-family:'Helvetica Neue', Helvetica, Arial, sans-serif;font-size:13px;color:#26282a;">
                
                <div>
                    On Tuesday, 26 July 2022 at 02:27:51 GMT+8, Zac Harvey <bitbythecron@gmail.com> wrote:
                </div>
                <div><br></div>
                <div><br></div>
                <div><div id="ydpf596612byiv5753818035"><div><div dir="ltr"><div>Thank you Ceki! I called start() in the CatAppender constructor and everything is now working. Are there recommended practices as to when (and from where) to call start() and stop()? Thanks again so much!</div><div><br clear="none"></div><div>Best,</div><div>Zac<br clear="none"></div></div><br clear="none"><div id="ydpf596612byiv5753818035yqt37883" class="ydpf596612byiv5753818035yqt6638549876"><div class="ydpf596612byiv5753818035gmail_quote"><div dir="ltr" class="ydpf596612byiv5753818035gmail_attr">On Mon, Jul 25, 2022 at 2:14 PM Ceki Gülcü <<a shape="rect" href="mailto:ceki@qos.ch" rel="nofollow" target="_blank">ceki@qos.ch</a>> wrote:<br clear="none"></div><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex;" class="ydpf596612byiv5753818035gmail_quote">Hello Zac,<br clear="none">
<br clear="none">
AppenderBase will not invoke the append() method less the appender has<br clear="none">
the started flag set to true.<br clear="none">
<br clear="none">
<br clear="none">
-- <br clear="none">
Ceki Gülcü<br clear="none">
<br clear="none">
Sponsoring SLF4J/logback/reload4j at <a shape="rect" href="https://github.com/sponsors/qos-ch" rel="nofollow" target="_blank">https://github.com/sponsors/qos-ch</a><br clear="none">
<br clear="none">
On 7/25/2022 6:38 PM, Zac Harvey wrote:<br clear="none">
> Java 11 and logback-classic-1.2.11 here. I'm trying to write my own<br clear="none">
> custom appender and am following this Baeldung article<br clear="none">
> <<a shape="rect" href="https://www.baeldung.com/custom-logback-appender" rel="nofollow" target="_blank">https://www.baeldung.com/custom-logback-appender</a>> to test it out.<br clear="none">
> <br clear="none">
> My *src/main/java/myapp/logging/CatAppender* appender (on the runtime<br clear="none">
> classpath):<br clear="none">
> <br clear="none">
> public class CatAppender extends AppenderBase<ILoggingEvent> {<br clear="none">
>     @Override<br clear="none">
>     protected void append(ILoggingEvent eventObject) {<br clear="none">
>         System.out.println("meow");<br clear="none">
>     }<br clear="none">
> }<br clear="none">
> <br clear="none">
> My *src/main/resources/logback.xml*:<br clear="none">
> <br clear="none">
> <?xml version="1.0" encoding="UTF-8"?><br clear="none">
> <configuration debug="true"><br clear="none">
> <br clear="none">
>     <appender name="cat" class="myapp.logging.CatAppender"/><br clear="none">
> <br clear="none">
>     <root level="info"><br clear="none">
>         <appender-ref ref="cat" /><br clear="none">
>     </root><br clear="none">
> <br clear="none">
> </configuration><br clear="none">
> <br clear="none">
> In my *build.gradle* I specify to use logback and Lombok:<br clear="none">
> <br clear="none">
> plugins {<br clear="none">
>     id "io.freefair.lombok" version '6.4.0'<br clear="none">
> }<br clear="none">
> <br clear="none">
> dependencies {<br clear="none">
>     implementation (<br clear="none">
>         'ch.qos.logback:logback-classic:1.2.11'<br clear="none">
>         ,'org.projectlombok:lombok:1.18.16'<br clear="none">
>     )<br clear="none">
> }<br clear="none">
> <br clear="none">
> And then in my Java code I use Lombok to inject an SLF4J logger like so:<br clear="none">
> <br clear="none">
> @Slf4j<br clear="none">
> public class SomethingDoer {<br clear="none">
> <br clear="none">
>     public void doSomething() {<br clear="none">
>         <a shape="rect" href="http://log.info" rel="nofollow" target="_blank">log.info</a> <<a shape="rect" href="http://log.info" rel="nofollow" target="_blank">http://log.info</a>>("this should invoke the CatAppender...");<br clear="none">
>     }<br clear="none">
> <br clear="none">
> }<br clear="none">
> <br clear="none">
> But when *SomethingDoer#doSomething()* runs, I don't see a meow printed<br clear="none">
> to my STDOUT console. Have I wired anything up incorrectly here?<br clear="none">
> <br clear="none">
_______________________________________________<br clear="none">
logback-user mailing list<br clear="none">
<a shape="rect" href="mailto:logback-user@qos.ch" rel="nofollow" target="_blank">logback-user@qos.ch</a><br clear="none">
<a shape="rect" href="http://mailman.qos.ch/mailman/listinfo/logback-user" rel="nofollow" target="_blank">http://mailman.qos.ch/mailman/listinfo/logback-user</a></blockquote></div></div>
</div></div><div class="ydpf596612byqt6638549876" id="ydpf596612byqt96251">_______________________________________________<br clear="none">logback-user mailing list<br clear="none"><a shape="rect" href="mailto:logback-user@qos.ch" rel="nofollow" target="_blank">logback-user@qos.ch</a><br clear="none"><a shape="rect" href="http://mailman.qos.ch/mailman/listinfo/logback-user" rel="nofollow" target="_blank">http://mailman.qos.ch/mailman/listinfo/logback-user</a></div></div>
            </div>
        </div></body></html>