Quarkus - quarkus-logging-logback issues with TimeBasedRollingPolicy

181 views
Skip to first unread message

Anthony Chaput

unread,
Jul 27, 2023, 4:49:48 AM7/27/23
to Quarkus Development mailing list
Good morning,

I'm having trouble using the rollingPolicy: TimeBasedRollingPolicy

I have the error message "Cannot read field "fileNamePattern" because "this.tbrp" is null"


Here is the part of my logback file : 
<!-- ===== LOG_FILE : logs applicatives ===== -->
<appender name="LOG_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<!--<file>${apim.ws.log.folder}apim-ws.log</file>-->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<FileNamePattern>${apim.ws.collect.logs}apim-ws.%d{yyyy-MM-dd}.%i.log</FileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>${apim.ws.max.file.size}</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>

<maxHistory>${apim.ws.log.rolling.day}</maxHistory>
<maxIndex>{apim.ws.log.max.index}</maxIndex>
</rollingPolicy>
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>${apim.ws.filter.basic.log.level}</level>
</filter>
<encoder>
<pattern>[%d{dd-MM-yyyy HH:mm:ss:SSS}] [%.20thread] [%level] [%logger{0}] %msg%n %xException{short}</pattern>
</encoder>
</appender>

The 3 grey lines doesn't work : 
10:43:29,690 |-INFO in io.quarkiverse.logback.runtime.LogbackRecorder$1@23a06b3e - Registering current configuration as safe fallback point

2023-07-27 10:43:30,056 ERROR [io.qua.run.Application] (Quarkus Main Thread) Failed to start application (with profile [dev]): java.lang.RuntimeException: Failed to start quarkus
at io.quarkus.runner.ApplicationImpl.doStart(Unknown Source)
at io.quarkus.runtime.Application.start(Application.java:101)
at io.quarkus.runtime.ApplicationLifecycleManager.run(ApplicationLifecycleManager.java:111)
at io.quarkus.runtime.Quarkus.run(Quarkus.java:71)
at io.quarkus.runtime.Quarkus.run(Quarkus.java:44)
at io.quarkus.runtime.Quarkus.run(Quarkus.java:124)
at io.quarkus.runner.GeneratedMain.main(Unknown Source)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
at java.base/java.lang.reflect.Method.invoke(Method.java:578)
at io.quarkus.runner.bootstrap.StartupActionImpl$1.run(StartupActionImpl.java:104)
at java.base/java.lang.Thread.run(Thread.java:1623)
Caused by: java.lang.NullPointerException: Cannot read field "fileNamePattern" because "this.tbrp" is null
at ch.qos.logback.core.rolling.TimeBasedFileNamingAndTriggeringPolicyBase.start(TimeBasedFileNamingAndTriggeringPolicyBase.java:55)
at ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP.start(SizeAndTimeBasedFNATP.java:63)
at ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP$$delayed.doQuarkusDelayedStart(Unknown Source)
at io.quarkiverse.logback.runtime.LogbackRecorder.createHandler(LogbackRecorder.java:144)
at io.quarkus.deployment.steps.LoggingLogbackProcessor$handler1311068917.deploy_0(Unknown Source)
at io.quarkus.deployment.steps.LoggingLogbackProcessor$handler1311068917.deploy(Unknown Source)
... 11 more


Cannot read field "fileNamePattern" because "this.tbrp" is null
i suppose that this.tbrp is null means that this TimeBAsedRollingPolicy is null , do you know why and ho to solve this error ? 


a FixedWindowTollingPolicy works 
<rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
<FileNamePattern>${apim.ws.collect.trouble.logs}apim-ws-troubleshooting.%i.log</FileNamePattern>
<maxIndex>${apim.ws.log.max.index}</maxIndex>
</rollingPolicy>
but not really what i need ... , mix time and size is much better sometimes

in case here is my dependencies: 
<dependency>
<groupId>io.quarkiverse.logging.logback</groupId>
<artifactId>quarkus-logging-logback</artifactId>
<version>1.1.1</version>
</dependency>

<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>${logback.version}</version>
</dependency>

<dependency>
<groupId>io.quarkiverse.logging.logback</groupId>
<artifactId>quarkus-logging-logback-deployment</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>io.quarkiverse.logging.logback</groupId>
<artifactId>quarkus-logging-logback-impl</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>io.quarkiverse.logging.logback</groupId>
<artifactId>quarkus-logging-logback-impl-deployment</artifactId>
<version>1.1.1</version>
</dependency>

Guillaume Smet

unread,
Jul 27, 2023, 5:43:22 AM7/27/23
to chaput....@gmail.com, Quarkus Development mailing list
Hi,

Is it in native or even in JVM mode?

Could you create an issue in the Quarkiverse extension with a small reproducer attached?

Thanks!

--
You received this message because you are subscribed to the Google Groups "Quarkus Development mailing list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to quarkus-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/quarkus-dev/579ffd5d-0400-44dc-9f14-59037a457489n%40googlegroups.com.

Anthony Chaput

unread,
Jul 27, 2023, 9:28:30 AM7/27/23
to Quarkus Development mailing list
Here is my issue : 
https://github.com/quarkiverse/quarkus-logging-logback/issues/143

PS: this is my first issue, let me know if it's incomplete 
Reply all
Reply to author
Forward
0 new messages