An application built using Spring Boot 3 will fail to start if you try to conditionally include (using the <springProfile> tag) another logback configuration file into the project's logback-spring.xml file, when the included configuration contains a SIFT appender (cf https://logback.qos.ch/manual/appenders.html#SiftingAppender).
I made a sample app that demonstrates the issue: https://github.com/sebphil/springboot3-logback-sift-issue
Here are the first few lines of the startup log: ```Logging system failed to initialize using configuration from 'null' java.lang.IllegalStateException: Logback configuration error detected: ERROR in ch.qos.logback.core.joran.action.AppenderAction - Missing attribute [class] in element [sift] near line 9 ERROR in ch.qos.logback.core.joran.action.AppenderAction - Missing attribute [name] in element [sift] near line 9 ERROR in ch.qos.logback.classic.sift.SiftingAppender[SIFT] - AppenderFactory has not been set. Aborting
Unconditionally including the SIFT appender, or contionally including a non-SIFT appender works fine. The failure happens only when you include a file containing a SIFT appender from within a `<springProfile>` tag.
This works fine in Spring Boot 2.7.
**Comment From: scottfrederick**
@sebphil Thanks for the report and the sample. This appears to be a problem with Logback.
In Spring Boot 3, we upgraded to Logback 1.4. This required us to modify the implementation of `springProfile`, and it is now aligned as closely as possible to how Logback's built-in conditionals work. I was able to reproduce your error by renaming your `logback-spring.xml` file to `logback.xml` and replacing the `springProfile` conditional with `if` to get Spring Boot out of the picture:
```xml
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<!-- but conditionally including a sift appender makes the app crash at startup -->
<if condition='isDefined("test")'>
<include resource="logback-sift.xml"/>
</if>
<root level="INFO">
<appender-ref ref="CONSOLE"/>
</root>
</configuration>
Along with adding Janino to the application dependencies so the conditional compiles:
<dependency>
<groupId>org.codehaus.janino</groupId>
<artifactId>janino</artifactId>
</dependency>
Please file a bug report with Logback. A simplified example that does not use Spring is likely to help them diagnose the problem. You can add comments here with any follow-up such as a link to a Logback bug report.
Comment From: sebphil
I found an issue in the Logback jira that seems similar to mine: https://jira.qos.ch/browse/LOGBACK-1713