this is my logback-spring.xml file
<included>
<configuration>
<springProfile name="dev,uat">
<appender name="SIFT"
class="ch.qos.logback.classic.sift.SiftingAppender">
<discriminator>
<key>fileName</key>
<defaultValue>/var/lib/unknown.log
</defaultValue>
</discriminator>
<sift>
<appender name="FILE-${fileName}"
class="ch.qos.logback.core.FileAppender">
<file>${fileName}</file>
<layout class="ch.qos.logback.classic.PatternLayout">
<pattern>%d{dd-MM-yyyy HH:mm:ss.SSS} | %level | %msg%n%rEx
</pattern>
</layout>
</appender>
</sift>
</appender>
</springProfile>
<turboFilter
class="ch.qos.logback.classic.turbo.DynamicThresholdFilter">
<Key>logLevel</Key>
<DefaultThreshold>TRACE</DefaultThreshold>
<MDCValueLevelPair>
<value>off</value>
<level>ERROR</level>
</MDCValueLevelPair>
<MDCValueLevelPair>
<value>DEBUG</value>
<level>DEBUG</level>
</MDCValueLevelPair>
<MDCValueLevelPair>
<value>TRACE</value>
<level>TRACE</level>
</MDCValueLevelPair>
<MDCValueLevelPair>
<value>INFO</value>
<level>INFO</level>
</MDCValueLevelPair>
<MDCValueLevelPair>
<value>ERROR</value>
<level>ERROR</level>
</MDCValueLevelPair>
<MDCValueLevelPair>
<value>WARN</value>
<level>WARN</level>
</MDCValueLevelPair>
</turboFilter>
<springProfile name="dev,uat">
<root level="TRACE">
<appender-ref ref="SIFT" />
</root>
</springProfile>
<springProfile name="dev">
<appender name="stdout"
class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d{dd-MM-yyyy HH:mm:ss.SSS} %5p %t %c{2}:%L - %m%n
</pattern>
</encoder>
</appender>
</springProfile>
<springProfile name="dev">
<root level="TRACE">
<appender-ref ref="stdout" />
</root>
</springProfile>
</configuration>
</included>
but i am getting this error
java.lang.IllegalStateException: Logback configuration error detected:
ERROR in ch.qos.logback.core.joran.action.AppenderAction - Missing attribute [class] in element [sift] near line 11
ERROR in ch.qos.logback.core.joran.action.AppenderAction - Missing attribute [name] in element [sift] near line 11
ERROR in org.springframework.boot.logging.logback.SpringBootJoranConfigurator@515e8a - Could not find valid configuration instructions. Exiting.
Comment From: mhalbritter
I can't reproduce this. If i paste the logback-spring.xml in my project, I get:
Caused by: java.lang.IllegalStateException: Logback configuration error detected:
ERROR in org.springframework.boot.logging.logback.SpringBootJoranConfigurator@3e6f3f28 - Could not find valid configuration instructions. Exiting.
at org.springframework.boot.logging.logback.LogbackLoggingSystem.reportConfigurationErrorsIfNecessary(LogbackLoggingSystem.java:260)
at org.springframework.boot.logging.logback.LogbackLoggingSystem.loadConfiguration(LogbackLoggingSystem.java:247)
at org.springframework.boot.logging.AbstractLoggingSystem.initializeWithConventions(AbstractLoggingSystem.java:80)
at org.springframework.boot.logging.AbstractLoggingSystem.initialize(AbstractLoggingSystem.java:60)
at org.springframework.boot.logging.logback.LogbackLoggingSystem.initialize(LogbackLoggingSystem.java:187)
at org.springframework.boot.context.logging.LoggingApplicationListener.initializeSystem(LoggingApplicationListener.java:332)
... 19 more
When i remove the <included> tag, it works like expected.
If you'd like us to spend some time investigating, please take the time to provide a complete minimal sample (something that we can unzip or git clone, build, and deploy) that reproduces the problem.
Comment From: spring-projects-issues
If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.
Comment From: spring-projects-issues
Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue.
Comment From: medAmineRg
i guess i figure out the problem. you have to change the pattern from:
<pattern>%d{dd-MM-yyyy HH:mm:ss.SSS} %5p %t %c{2}:%L - %m%n</pattern>
to:
<pattern>%d{dd-MM-yyyy HH:mm:ss.SSS} %5p %t %logger{2}:%L - %m%n</pattern>