24

I see that there are instructions on enabling verbose logging for wiremock when running it in standalone fashion at http://wiremock.org/running-standalone.html (see --verbose).

How do I enable the same when starting it from a java code?

Superaghu
  • 775
  • 1
  • 5
  • 15

3 Answers3

24

If you're using a JUnit Rule, you can set the notifier to verbose mode like this:

@Rule
public WireMockRule serviceMock = new WireMockRule(new WireMockConfiguration().notifier(new Slf4jNotifier(true)));
robingrindrod
  • 474
  • 4
  • 18
Jason
  • 2,025
  • 2
  • 21
  • 13
  • 6
    Somehow this stopped working for me (probably version upgrade). I have replaced it with http://wiremock.org/docs/configuration/#notification-logging `.notifier(new ConsoleNotifier(true))`. – Tuno Jul 06 '18 at 07:50
  • I can confirm `Slf4jNotifier` working along with logback appender `com.github.tomakehurst.wiremock` set to to DEBUG. `wiremock-jre8:2.27.2`. – Abhijit Sarkar Oct 21 '20 at 08:44
13

WireMock uses SLF4J. Set the level of the category com.github.tomakehurst.wiremock to TRACE. Consult the SLF4J manual to find out how to accomplish this in your case.

Chry Cheng
  • 3,378
  • 5
  • 47
  • 79
2

Set Notifier to ConsoleNotifier(true).

WireMockRule wireMockRule = new WireMockRule(WireMockConfiguration.options().port(8080).httpsPort(443)
.notifier(new ConsoleNotifier(true)).extensions(new ResponseTemplateTransformer(true)));
Hari Krishna
  • 3,658
  • 1
  • 36
  • 57