Hello. Is there any way to have Wiremock log in JS...
# help
m
Hello. Is there any way to have Wiremock log in JSON format? I'm using a fat jar compiled from source
l
This isn't really possible at the moment. We do have plans to overhaul the logging as detailed here - https://github.com/wiremock/wiremock/issues/1471
m
Thank you @Lee Turner. In that thread, OP writes:
Standalone JAR includes its own logger implementation
Wouldn't that fit my use case then? Maybe that logger can be influenced?
l
Not to my knowledge. Others might have more experience with this than me. Standalone currently users a hardcoded
ConsoleNotifier
implementation - https://github.com/wiremock/wiremock/blob/97e902eabc4a1a6fd1d8be0f889e3aebe82e4db6[…]/github/tomakehurst/wiremock/standalone/CommandLineOptions.java This just outputs to stdout and stderr with very little additional control. There have been a number of PRs to address this but they were closed in favour of the logging redesign linked above
t
You can add a
ServeEventListener
and serialise the `ServeEvent`s received by that to JSON. This is an extension point, so can be loaded from your own JAR if you don’t want to repackage the standalone JAR.