qos-ch / logback

The reliable, generic, fast and flexible logging framework for Java.
http://logback.qos.ch
Other
2.97k stars 1.28k forks source link

No Log starting from Version 1.5.5 using included file from resources of jar #810

Closed coinzz closed 4 months ago

coinzz commented 4 months ago

1.5.4 is the last version where our log is still working. We have the following constellation:

Using an included logback from the resource folder of one of our own libraries. Our main project has the logback-spring.xml as follows:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <include resource="logback-common.xml"/>
</configuration>

and the logback-common.xml file is found in the resource folder inside a jar file library that we build.

I get the following logback log for all versions using the jar: 15:58:49,768 |-INFO in ch.qos.logback.core.joran.spi.ConfigurationWatchList@1d9bec4d - URL [jar:file:/C:/Users/XX/.m2/repository/XX/XX/XX/XX/XX/XX.jar!/logback-common.xml] is not of type file

When we customize our pom to work with the code locally without a jar file all logback versions have the following: 16:01:08,532 |-INFO in ch.qos.logback.core.joran.util.ConfigurationWatchListUtil@1e5f4170 - Adding [file:/C:/Users/XX/AppData/Local/Workspaces/intellij/XX/XX/target/classes/logback-common.xml] to configuration watch list.

In both cases 1.5.4 is able to print the application log, but starting from 1.5.5 no application log is produced anymore. Any ideas what changed starting from 1.5.5? Hope these information are enough at first.

ceki commented 4 months ago

In 1.3.x and until logback 1.5.4, Joran performed configuration using two distinct steps. It first read XML file (or files) and transformed it (or them) into an internal model. The model was processed separately using a processor which delegated processing to ModelHandlers. However, the ingestion of included XML files occurred in a much earlier step before the model was processed.

In logback 1.5.5 and later, the ingestion of included XML files occurs during model processing which allows for more coherent treatment of included files. For exact changes see commit af92be47a fixing issue LOGBACK-1746 as well as LOGBACK-1732, LOGBACK-1760 and LOGBACK-1746.

As for as I can tell, the problem is most likely due to the Spring Boot not having updated its code to work with version 1.5.5. Are you using Spring Boot?

ceki commented 4 months ago

Related to https://github.com/spring-projects/spring-boot/issues/40491

coinzz commented 3 months ago

Ah yes thanks, we are using spring boot 3.2.x. Guess we will wait to use logback >= 1.5.5 after spring has fixed this issue :)