@@ -27,7 +27,7 @@ class ConfigureLoggerLevelTest implements RewriteTest {
2727 @ Test
2828 void editExistingLogger () {
2929 rewriteRun (
30- spec -> spec .recipe (new ConfigureLoggerLevel ("org.springframework" , ConfigureLoggerLevel .LogLevel .off )),
30+ spec -> spec .recipe (new ConfigureLoggerLevel ("org.springframework" , ConfigureLoggerLevel .LogLevel .off , null )),
3131 xml (//language=xml
3232 """
3333 <configuration>
@@ -67,7 +67,7 @@ void editExistingLogger() {
6767 @ Test
6868 void addNewLogger () {
6969 rewriteRun (
70- spec -> spec .recipe (new ConfigureLoggerLevel ("com.example.MyClass" , ConfigureLoggerLevel .LogLevel .off )),
70+ spec -> spec .recipe (new ConfigureLoggerLevel ("com.example.MyClass" , ConfigureLoggerLevel .LogLevel .off , null )),
7171 xml (//language=xml
7272 """
7373 <configuration>
@@ -104,4 +104,45 @@ void addNewLogger() {
104104 spec -> spec .path ("logback.xml" ))
105105 );
106106 }
107+
108+ @ Test
109+ void logbackSpring () {
110+ rewriteRun (
111+ spec -> spec .recipe (new ConfigureLoggerLevel ("com.example.MyClass" , ConfigureLoggerLevel .LogLevel .off , "**/logback-spring.xml" )),
112+ xml (//language=xml
113+ """
114+ <configuration>
115+ <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
116+ <layout class="ch.qos.logback.classic.PatternLayout">
117+ <Pattern>
118+ %d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n
119+ </Pattern>
120+ </layout>
121+ </appender>
122+
123+ <logger name="org.springframework" level="error" additivity="false">
124+ <appender-ref ref="STDOUT" />
125+ </logger>
126+ </configuration>
127+ """ ,
128+ //language=xml
129+ """
130+ <configuration>
131+ <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
132+ <layout class="ch.qos.logback.classic.PatternLayout">
133+ <Pattern>
134+ %d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n
135+ </Pattern>
136+ </layout>
137+ </appender>
138+
139+ <logger name="org.springframework" level="error" additivity="false">
140+ <appender-ref ref="STDOUT" />
141+ </logger>
142+ <logger name="com.example.MyClass" level="off"/>
143+ </configuration>
144+ """ ,
145+ spec -> spec .path ("logback-spring.xml" ))
146+ );
147+ }
107148}
0 commit comments