wiremock / wiremock-docker

Wiremock Docker image
https://hub.docker.com/r/wiremock/wiremock
MIT License
218 stars 101 forks source link

Logging to stdout missing #7

Closed bmarwell closed 6 years ago

bmarwell commented 6 years ago

Hello, and thank you for your docker wiremock container!

When starting wiremock, I get this warning:

wiremock_1  | SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
wiremock_1  | SLF4J: Defaulting to no-operation (NOP) logger implementation
wiremock_1  | SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.

I think it should be sufficient to add logback-classic to the classpath. Configuration should not be necessary. Just in case someone wants to modify logging, you could add this JVM parameter: -Dlogback.configurationFile or -Dlogging.config.

Thanks in advance!

bmarwell commented 6 years ago

Artifacts required:

Dropping those will make logback start in debug mode.

rodolpheche commented 6 years ago

Hello,

The Docker image that I have published, is aligned with the Wiremock default usage. As with Wiremock, it is the user responsibility to customise the image to meet his needs, as he would have do when using Wiremock outside of a container.

As you can see in the Dockerfile (https://github.com/rodolpheche/wiremock-docker/blob/master/Dockerfile), Wiremock starts with a preconfigured classpath :

CMD ["java", "-cp", "/var/wiremock/lib/*:/var/wiremock/extensions/*",
"com.github.tomakehurst.wiremock.standalone.WireMockServerRunner"]

So, you just have to put your jar into the path /var/wiremock/lib/ The following Dockerfile content will allow you to do this :

FROM rodolpheche/wiremock
ADD https://repo1.maven.org/maven2/ch/qos/logback/logback-core/1.2.3/logback-core-1.2.3.jar /var/wiremock/lib
ADD https://repo1.maven.org/maven2/ch/qos/logback/logback-classic/1.2.3/logback-classic-1.2.3.jar /var/wiremock/lib
bmarwell commented 6 years ago

Hi @rodolpheche ,

thank you for your answer. This is what I already did, as you can guess from the 2nd post from this thread.

I think logback should be there by default, including a sane configuration. Why? Because basic logging is considered best practice. You'd make a lot of users very happy with a very small change.

This is meant as an Request for Enhancement, not as Question or Bug.

Thank you very much! 👍

rodolpheche commented 6 years ago

Hi!

I understand that it's very small change, but it's not the responsibility of the Docker image to do that. The usage of Wiremock should be the same regardless of your context (containerized or not).