mirror of
https://github.com/spring-projects/spring-framework
synced 2026-06-08 17:33:33 +00:00
aa2028127f
This commit overhauls the TestExecutionListener for Micrometer's ObservationRegistry that was introduced in the previous commit. Specifically, this commit: - Renames the listener to MicrometerObservationRegistryTestExecutionListener since the use of a ThreadLocal is an implementation detail that may change over time. - Makes the listener package-private instead of public in order to allow the team greater flexibility in evolving this feature. - Eagerly loads the ObservationThreadLocalAccessor class and verifies that it has a getObservationRegistry() method to ensure that the listener is properly skipped when SpringFactoriesLoader attempts to load it, if Micrometer 1.10.8+ is not on the classpath. - Switches the listener's automatic registration order to 2500 in order to register it after the DependencyInjectionTestExecutionListener. - Only tracks the previous ObservationRegistry in beforeTestMethod() if the test's ApplicationContext contains an ObservationRegistry bean. - Properly removes the TestContext attribute for the previous ObservationRegistry in afterTestMethod(). - Introduces DEBUG logging for diagnostics. - Adds an entry in the Javadoc for TestExecutionListener as well as in the Testing chapter in the reference manual. Closes gh-30658
42 lines
2.3 KiB
XML
42 lines
2.3 KiB
XML
<?xml version="1.0" encoding="UTF-8"?>
|
|
<Configuration status="WARN">
|
|
<Appenders>
|
|
<Console name="Console" target="SYSTEM_OUT">
|
|
<PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{1.} - %msg%n" />
|
|
</Console>
|
|
<File name="File" fileName="build/logs/spring-test.log">
|
|
<PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{1.} - %msg%n" />
|
|
</File>
|
|
</Appenders>
|
|
<Loggers>
|
|
<Logger name="org.junit.platform" level="info" />
|
|
<Logger name="org.springframework.test.context" level="warn" />
|
|
<Logger name="org.springframework.test.context.TestContext" level="warn" />
|
|
<Logger name="org.springframework.test.context.TestContextManager" level="warn" />
|
|
<Logger name="org.springframework.test.context.ContextLoaderUtils" level="warn" />
|
|
<Logger name="org.springframework.test.context.aot" level="info" />
|
|
<Logger name="org.springframework.test.context.cache" level="warn" />
|
|
<Logger name="org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate" level="info" />
|
|
<Logger name="org.springframework.test.context.junit4.rules" level="warn" />
|
|
<Logger name="org.springframework.test.context.observation" level="warn" />
|
|
<Logger name="org.springframework.test.context.transaction.TransactionalTestExecutionListener" level="warn" />
|
|
<Logger name="org.springframework.test.context.web" level="warn" />
|
|
<!-- The following must be kept at DEBUG in order to test SPR-14363. -->
|
|
<Logger name="org.springframework.test.util" level="debug" />
|
|
<!--
|
|
<Logger name="org.springframework.test.context.support" level="info" />
|
|
<Logger name="org.springframework.test.context.support.DelegatingSmartContextLoader" level="info" />
|
|
<Logger name="org.springframework.test.context.support.AbstractGenericContextLoader" level="info" />
|
|
<Logger name="org.springframework.test.context.support.AnnotationConfigContextLoader" level="info" />
|
|
<Logger name="org.springframework.test.context.support.AbstractDirtiesContextTestExecutionListener" level="warn" />
|
|
<Logger name="org.springframework.test.context.support.TestPropertySourceUtils" level="trace" />
|
|
<Logger name="org.springframework.beans" level="warn" />
|
|
<Logger name="org.springframework.test.web.servlet.result" level="debug" />
|
|
-->
|
|
<Root level="error">
|
|
<AppenderRef ref="Console" />
|
|
<AppenderRef ref="File" />
|
|
</Root>
|
|
</Loggers>
|
|
</Configuration>
|