如何在非独立线缆中启用详细日志记录

Sup*_*ghu 16 wiremock

我看到在http://wiremock.org/running-standalone.html以独立方式运行时,有关于为wiremock启用详细日志记录的说明(请参阅--verbose).

从java代码启动它时如何启用它?

Jas*_*son 18

如果您正在使用JUnit规则,则可以将通知程序设置为详细模式,如下所示:

@Rule
public WireMockRule serviceMock = new WireMockRule(new WireMockConfiguration().notifier(new Slf4jNotifier(true)));
Run Code Online (Sandbox Code Playgroud)

  • 不知何故,这对我不起作用(可能是版本升级)。我已将其替换为 http://wiremock.org/docs/configuration/#notification-logging `.notifier(new ConsoleNotifier(true))`。 (3认同)

Chr*_*eng 7

WireMock使用SLF4J.将类别的级别设置com.github.tomakehurst.wiremockTRACE.请参阅SLF4J手册,了解如何在您的情况下完成此操作.