From luthiger at gmail.com Sun Jul 2 17:04:35 2023 From: luthiger at gmail.com (Benno Luthiger) Date: Sun, 2 Jul 2023 17:04:35 +0200 Subject: [logback-user] OSGi Application: Janino on classpath? Message-ID: Hello everybody I want to use conditional processing in my logback.xml of my OSGi application. I learnt that I have to add the Janino library (and the Janino commons-compiler) to the application's classpath. I do that and let the OSGi container (*equinox*) start these libraries. However, I still get the error '*ERROR in ch.qos.logback.core.model.processor.conditional.IfModelHandler - Could not find Janino library on the class path. Skipping conditional processing.*'. What is the proper way to add the Janino library to the classpath (in an OSGi application)? Note: I've also downloaded and added 'janino-fragment' from logback-contrib. Still the same result. Best, Benno -------------- next part -------------- An HTML attachment was scrubbed... URL: From tonvanbart at gmail.com Wed Jul 5 23:14:53 2023 From: tonvanbart at gmail.com (Ton van Bart) Date: Wed, 5 Jul 2023 23:14:53 +0200 Subject: [logback-user] Custom appender: output of addWarn() not showing Message-ID: Hello, I have created a custom Logback appender which sends the log events to a Kafka topic. In order to verify if producing to Kafka was successful, I check the result and do an addWarn("Failed to produce logging", e) if there was an exception. Similarly, I tried to add an addInfo("produced offset:" + matadata.offset()) when a produce is successful. I'm using this appender in Kafka Connect, where I have wrapped it in an AsyncAppender; however, neither message is showing. I also tried printing to System.out / System.err from within the appender with the same (lack of) result: during start up of Connect, I do see addInfo() messages, but during normal processing, everything goes silent. No messages appear on the topic so I assume something went wrong; when testing the setup in a local docker compose, it works, so there must be some problem somewhere. I understand that this may be due to the combination with Kafka Connect, my question is: should I expect addInfo() etc. to show up in normal appender processing (i.e. calling it from within append() or is this internal logging for use only in appender start() ? What would be the standard way for an appender to report errors during append()? Note: due to circumstances beyond my control, I'm currently stuck on Logback 1.2.11 . Thanks in advance for any tips, kind regards, Ton -------------- next part -------------- An HTML attachment was scrubbed... URL: From ceki at qos.ch Thu Jul 6 13:00:36 2023 From: ceki at qos.ch (=?UTF-8?B?Q2VraSBHw7xsY8O8?=) Date: Thu, 6 Jul 2023 13:00:36 +0200 Subject: [logback-user] Custom appender: output of addWarn() not showing In-Reply-To: References: Message-ID: <43985da8-d46d-d166-1461-1d5589c5d7eb@qos.ch> Hello Ton, Have you tried adding a statusListener on the command line? See https://logback.qos.ch/manual/configuration.html#logback.statusLC StatusListeners should work the same way in logback version 1.2. Let us know if this helps, -- Ceki Gülcü Sponsoring SLF4J/logback/reload4j at https://github.com/sponsors/qos-ch On 7/5/2023 11:14 PM, Ton van Bart via logback-user wrote: > Hello, > I have created a custom Logback appender which sends the log events to a > Kafka topic. In order to verify if producing to Kafka was successful, I > check the result and do an addWarn("Failed to produce logging", e) if > there was an exception. > Similarly, I tried to add an addInfo("produced offset:" + > matadata.offset()) when a produce is successful. > > I'm using this appender in Kafka Connect, where I have wrapped it in an > AsyncAppender; however, neither message is showing. I also tried > printing to System.out / System.err from within the appender with the > same (lack of) result: during start up of Connect, I do see addInfo() > messages, but during normal processing, everything goes silent. No > messages appear on the topic so I assume something went wrong; when > testing the setup in a local docker compose, it works, so there must be > some problem somewhere. > > I understand that this may be due to the combination with Kafka Connect, > my question is: should I expect addInfo() etc. to show up in normal > appender processing (i.e. calling it from within append() or is this > internal logging for use only in appender start() ? What would be the > standard way for an appender to report errors during append()? > > Note: due to circumstances beyond my control, I'm currently stuck on > Logback 1.2.11 . > > Thanks in advance for any tips, kind regards, Ton > > _______________________________________________ > logback-user mailing list > logback-user at qos.ch > https://mailman.qos.ch/cgi-bin/mailman/listinfo/logback-user From tonvanbart at gmail.com Fri Jul 7 14:53:26 2023 From: tonvanbart at gmail.com (Ton van Bart) Date: Fri, 7 Jul 2023 14:53:26 +0200 Subject: [logback-user] Custom appender: output of addWarn() not showing In-Reply-To: <43985da8-d46d-d166-1461-1d5589c5d7eb@qos.ch> References: <43985da8-d46d-d166-1461-1d5589c5d7eb@qos.ch> Message-ID: Thank you for the tip, that was very helpful! TBH I wasn't aware of StatusListeners... I added an OnConsoleStatusListener in logback.xml, as I mentioned this appender is added to Kafka Connect - which we have running in Kubernetes - and messages started showing up (albeit with a delay, which I think is due to fact that I'm logging in the callback passed to Kafka produce(). So, for my understanding, any statuses added during appender start() are picked up and shown, but statuses added during append() are not shown _unless_ you explicitly add a status listener, is that correct? Thanks again for your help, kind regards, Ton On Thu, Jul 6, 2023 at 1:00 PM Ceki Gülcü via logback-user < logback-user at qos.ch> wrote: > Hello Ton, > > Have you tried adding a statusListener on the command line? > > See https://logback.qos.ch/manual/configuration.html#logback.statusLC > > StatusListeners should work the same way in logback version 1.2. > > Let us know if this helps, > > -- > Ceki Gülcü > > Sponsoring SLF4J/logback/reload4j at https://github.com/sponsors/qos-ch > > On 7/5/2023 11:14 PM, Ton van Bart via logback-user wrote: > > Hello, > > I have created a custom Logback appender which sends the log events to a > > Kafka topic. In order to verify if producing to Kafka was successful, I > > check the result and do an addWarn("Failed to produce logging", e) if > > there was an exception. > > Similarly, I tried to add an addInfo("produced offset:" + > > matadata.offset()) when a produce is successful. > > > > I'm using this appender in Kafka Connect, where I have wrapped it in an > > AsyncAppender; however, neither message is showing. I also tried > > printing to System.out / System.err from within the appender with the > > same (lack of) result: during start up of Connect, I do see addInfo() > > messages, but during normal processing, everything goes silent. No > > messages appear on the topic so I assume something went wrong; when > > testing the setup in a local docker compose, it works, so there must be > > some problem somewhere. > > > > I understand that this may be due to the combination with Kafka Connect, > > my question is: should I expect addInfo() etc. to show up in normal > > appender processing (i.e. calling it from within append() or is this > > internal logging for use only in appender start() ? What would be the > > standard way for an appender to report errors during append()? > > > > Note: due to circumstances beyond my control, I'm currently stuck on > > Logback 1.2.11 . > > > > Thanks in advance for any tips, kind regards, Ton > > > > _______________________________________________ > > logback-user mailing list > > logback-user at qos.ch > > https://mailman.qos.ch/cgi-bin/mailman/listinfo/logback-user > _______________________________________________ > logback-user mailing list > logback-user at qos.ch > https://mailman.qos.ch/cgi-bin/mailman/listinfo/logback-user -------------- next part -------------- An HTML attachment was scrubbed... URL: From jim-logback at spudsoft.co.uk Fri Jul 7 15:11:55 2023 From: jim-logback at spudsoft.co.uk (jim-logback at spudsoft.co.uk) Date: Fri, 7 Jul 2023 14:11:55 +0100 Subject: [logback-user] Can LoggerContext take an MDCAdapter instead of a LogbackMDCAdapter Message-ID: <46e1c39b-747d-734e-23cd-bc1e55e4f39b@spudsoft.co.uk> Hi, At the moment LoggerContext works specifically with the LogbackMDCAdapter. This makes it difficult to replace it with an alternative implementation (I'm working with Vertx, thread-local isn't much use for me). Could LoggerContext work with the MDCAdapter interface instead? Thanks Jim From ceki at qos.ch Fri Jul 7 16:09:15 2023 From: ceki at qos.ch (=?UTF-8?B?Q2VraSBHw7xsY8O8?=) Date: Fri, 7 Jul 2023 16:09:15 +0200 Subject: [logback-user] Custom appender: output of addWarn() not showing In-Reply-To: References: <43985da8-d46d-d166-1461-1d5589c5d7eb@qos.ch> Message-ID: Glad to help. If there are any errors or warnings during first configuration, the status messages will be printed at the end of first configuration. However, no status messages will be printed after first configuration. Installing a status listener will print status messages during the lifetime of the application. Anyway, this is explained in the documentation I mentioned previously. -- Ceki Gülcü Sponsoring SLF4J/logback/reload4j at https://github.com/sponsors/qos-ch On 7/7/2023 2:53 PM, Ton van Bart via logback-user wrote: > Thank you for the tip, that was very helpful! > TBH I wasn't aware of StatusListeners... I added an > OnConsoleStatusListener in logback.xml, as I mentioned this appender is > added to Kafka Connect - which we have running in Kubernetes - and > messages started showing up (albeit with a delay, which I think is due > to fact that I'm logging in the callback passed to Kafka produce(). > So, for my understanding, any statuses added during appender start() are > picked up and shown, but statuses added during append() are not shown > _unless_ you explicitly add a status listener, is that correct? > > Thanks again for your help, kind regards, Ton > > > On Thu, Jul 6, 2023 at 1:00 PM Ceki Gülcü via logback-user > > wrote: > > Hello Ton, > > Have you tried adding a statusListener on the command line? > > See > https://logback.qos.ch/manual/configuration.html#logback.statusLC > > > StatusListeners should work the same way in logback version 1.2. > > Let us know if this helps, > > -- > Ceki Gülcü > > Sponsoring SLF4J/logback/reload4j at > https://github.com/sponsors/qos-ch > > On 7/5/2023 11:14 PM, Ton van Bart via logback-user wrote: > > Hello, > > I have created a custom Logback appender which sends the log > events to a > > Kafka topic. In order to verify if producing to Kafka was > successful, I > > check the result and do an addWarn("Failed to produce logging", e) if > > there was an exception. > > Similarly, I tried to add an addInfo("produced offset:" + > > matadata.offset()) when a produce is successful. > > > > I'm using this appender in Kafka Connect, where I have wrapped it > in an > > AsyncAppender; however, neither message is showing. I also tried > > printing to System.out / System.err from within the appender with the > > same (lack of) result: during start up of Connect, I do see addInfo() > > messages, but during normal processing, everything goes silent. No > > messages appear on the topic so I assume something went wrong; when > > testing the setup in a local docker compose, it works, so there > must be > > some problem somewhere. > > > > I understand that this may be due to the combination with Kafka > Connect, > > my question is: should I expect addInfo() etc. to show up in normal > > appender processing (i.e. calling it from within append() or is this > > internal logging for use only in appender start() ? What would be the > > standard way for an appender to report errors during append()? > > > > Note: due to circumstances beyond my control, I'm currently stuck on > > Logback 1.2.11 . > > > > Thanks in advance for any tips, kind regards, Ton > > > > _______________________________________________ > > logback-user mailing list > > logback-user at qos.ch > > https://mailman.qos.ch/cgi-bin/mailman/listinfo/logback-user > > _______________________________________________ > logback-user mailing list > logback-user at qos.ch > https://mailman.qos.ch/cgi-bin/mailman/listinfo/logback-user > > > > _______________________________________________ > logback-user mailing list > logback-user at qos.ch > https://mailman.qos.ch/cgi-bin/mailman/listinfo/logback-user From ceki at qos.ch Fri Jul 7 16:13:17 2023 From: ceki at qos.ch (=?UTF-8?B?Q2VraSBHw7xsY8O8?=) Date: Fri, 7 Jul 2023 16:13:17 +0200 Subject: [logback-user] Can LoggerContext take an MDCAdapter instead of a LogbackMDCAdapter In-Reply-To: <46e1c39b-747d-734e-23cd-bc1e55e4f39b@spudsoft.co.uk> References: <46e1c39b-747d-734e-23cd-bc1e55e4f39b@spudsoft.co.uk> Message-ID: Hi Jim, Yes, I think using MDCAdapter interface should be OK. Please create a jira issue at jira.qos.ch asking for this change. Best regards, -- Ceki Gülcü Sponsoring SLF4J/logback/reload4j at https://github.com/sponsors/qos-ch On 7/7/2023 3:11 PM, Jim via logback-user wrote: > > Hi, > > At the moment LoggerContext works specifically with the LogbackMDCAdapter. > > This makes it difficult to replace it with an alternative implementation > (I'm working with Vertx, thread-local isn't much use for me). > > Could LoggerContext work with the MDCAdapter interface instead? > > Thanks > > Jim From hakanskucuk at gmail.com Thu Jul 20 12:41:01 2023 From: hakanskucuk at gmail.com (=?UTF-8?B?SGFrYW4gS8O8w6fDvGs=?=) Date: Thu, 20 Jul 2023 13:41:01 +0300 Subject: [logback-user] size based rollback unexpected behaviour Message-ID: I have a basic spring boot application with the logback.xml below mylog.txt mylog-%d{yyyy-MM-dd}.%i.txt 1MB 60 1GB %d{yyyy-MM-dd HH:mm:ss.SSS} %-4relative [%thread] %-5level %logger{35} - %msg%n I created logs with the following code to test the rolling. @Slf4j @SpringBootApplication public class LogbackApplication implements CommandLineRunner { public static void main(String[] args) { SpringApplication.run(LogbackApplication.class, args); } @Override public void run(String... args) throws Exception { for (int i = 0; i < 100000; i++) { log.debug("This is DEBUG"); log.info("This is INFO"); log.warn("This is WARN"); } } } I observed a log file of more than 25 MB. It is not rolling. If I put some sleep statements inside logging, it rolls. Is it a bug? or am I misconfiguring it? or expected behavior because of performance reasons? -------------- next part -------------- An HTML attachment was scrubbed... URL: From hzj266771 at alibaba-inc.com Thu Jul 27 08:15:01 2023 From: hzj266771 at alibaba-inc.com (=?UTF-8?B?6IOh5a2Q5p2wKOiHtOiKgik=?=) Date: Thu, 27 Jul 2023 14:15:01 +0800 Subject: [logback-user] =?utf-8?q?LOGBACK-1742_cause_compatibility_issues_?= =?utf-8?q?when_use_custom_LoggerContext?= Message-ID: <4f7f6fbb-f94d-41e6-aa89-55c5ccd18453.hzj266771@alibaba-inc.com> Dear sir: I update logback form 1.4.7 to 1.4.8, then I find the logback logger could'n print log, the console print: LOGBACK: No context given for ch.qos.logback.core.ConsoleAppender[CONSOLE] I found an NPE (NullPointerException) here: Then I found this pr: https://github.com/qos-ch/logback/commit/9c318804cf8bbc27eac20513887fa426498a4837 . In my case, the LogContext is not created by LogbackLoggerSpaceFactory, it's created by myself. so the MDCAdapter in loggerContext is null, then cause NullPointerException. I think this is an incompatible change, as some users may customize LogContext in certain scenarios, which will cause the custom LogContexts to be unusable. I hope LogBack can consider fixing this compatibility issue, for example, to ensure backward compatibility by obtaining MDCAdapter from MDC when MDCAdapter obtained from LogContext is null. Thanks -------------- next part -------------- An HTML attachment was scrubbed... URL: