【发布时间】:2015-12-23 01:16:25
【问题描述】:
我在http://wiremock.org/running-standalone.html 看到有关于在以独立方式运行wiremock 时启用详细日志记录的说明(请参阅--verbose)。
从 java 代码启动时如何启用它?
【问题讨论】:
标签: wiremock
我在http://wiremock.org/running-standalone.html 看到有关于在以独立方式运行wiremock 时启用详细日志记录的说明(请参阅--verbose)。
从 java 代码启动时如何启用它?
【问题讨论】:
标签: wiremock
如果您使用的是 JUnit 规则,您可以将通知程序设置为详细模式,如下所示:
@Rule
public WireMockRule serviceMock = new WireMockRule(new WireMockConfiguration().notifier(new Slf4jNotifier(true)));
【讨论】:
.notifier(new ConsoleNotifier(true))。
Slf4jNotifier 与 logback appender com.github.tomakehurst.wiremock 一起工作,设置为 DEBUG。 wiremock-jre8:2.27.2.
WireMock 使用 SLF4J。将类别com.github.tomakehurst.wiremock 的级别设置为TRACE。请咨询SLF4J manual,了解如何在您的情况下完成此操作。
【讨论】:
将通知程序设置为 ConsoleNotifier(true)。
WireMockRule wireMockRule = new WireMockRule(WireMockConfiguration.options().port(8080).httpsPort(443)
.notifier(new ConsoleNotifier(true)).extensions(new ResponseTemplateTransformer(true)));
【讨论】: