Support <springProfile> in logback configurations

Include support for a new <springProfile> element which can be used in
`logback-spring.xml` files to selectively enable or disable parts of the
configuration. For example:

	<configuration>
		...
		<springProfile name="staging">
			<logger name="sample.logback" level="TRACE" />
		</springProfile>
		...
	</configuration>

Fixes gh-3338
This commit is contained in:
Phillip Webb
2015-06-26 13:34:35 -07:00
parent 5bc8f0f708
commit f3f562f386
19 changed files with 476 additions and 56 deletions

View File

@@ -35,4 +35,12 @@ public class SampleLogbackApplicationTests {
this.outputCapture.expect(not(containsString("Sample Trace Message")));
}
@Test
public void testProfile() throws Exception {
SampleLogbackApplication
.main(new String[] { "--spring.profiles.active=staging" });
this.outputCapture.expect(containsString("Sample Debug Message"));
this.outputCapture.expect(containsString("Sample Trace Message"));
}
}