问题描述
根据官方文档How to Debug,我需要在属性文件中添加以下内容以启用日志记录
logging.level.org.apache.http.wire=DEBUG
logging.level.com.github.tomakehurst.wiremock=DEBUG
但是,当请求发送到 wiremock 服务器时,我在控制台上看不到任何日志。我只获得 500 Internal Server Error
特定平台。因此,为了排除故障,我试图在请求到达wiremock 服务器时拦截活动。
在我的 pom 文件中
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-contract-stub-runner</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-webflux</artifactId>
<scope>test</scope>
</dependency>
我还尝试添加具有以下内容的 logback-test.xml
文件。但是,这也没有记录任何内容。
<logger name="com.github.tomakehurst.wiremock" level="DEBUG"/>
<logger name="wiremock.org" level="DEBUG"/>
<logger name="wiremock" level="DEBUG"/>
<logger name="/" level="DEBUG"/>
我的测试班
@RunWith(springrunner.class)
@SpringBoottest(webEnvironment = WebEnvironment.RANDOM_PORT,classes = MyApplication.class)
@AutoConfiguremockmvc
@TestPropertySource(
locations = "/application-integration-test.properties"
)
@AutoConfigurewiremock(port = 0)
@AutoConfigureWebTestClient(timeout = "100000")
public class MyApplicationTest {
private WebTestClient client;
@LocalServerPort
private int port;
@Before
public void setUp() throws Exception {
client = WebTestClient.bindToServer().baseUrl("http://localhost:" + port).build();
}
/// Test code
}
有人建议我缺少什么吗?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)