dwickern / sbt-swagger-play

sbt plugin for swagger-play
MIT License
12 stars 2 forks source link

Large volume of debug logs when running tests #15

Closed bursauxa closed 7 months ago

bursauxa commented 7 months ago

Hello, I am not sure whether this is a bug report or a question, but we have the following issue: when running tests in a project, the console output is filled with a large volume of debug logs from Swagger. In our case, which I assume this is proportionate to the number of endpoints, "large" means a couple of megabytes.

These logs from from the swagger library, here is an example:

10:44:09.219 [pool-42-thread-7] DEBUG io.swagger.converter.ModelConverterContextImpl -- resolveProperty [simple type, class java.lang.String]
10:44:09.219 [pool-42-thread-7] DEBUG io.swagger.jackson.ModelResolver -- Can't check class [simple type, class java.lang.String], java.lang.String

Output is clean when running sbt compile, the logs only appear when running sbt test. We set the Logback configuration file /test/resources/logback.xml to ignore all logs from swagger:

    <logger name="io.swagger" level="OFF" />

Unfortunately it had no effect. It appears that this file is ignored during plugin execution (it does take effect in the tests themselves). We also tried swaggerPlayValidate := false in build.sbt settings, but that did not help either.

dwickern commented 7 months ago

Do you have the same logfile spam if you run ;yourProject/clean; yourProject/assets/assets ? This plugin runs in compile scope so I don't think it would ever pick up logback config files from test resources.

bursauxa commented 7 months ago

Do you have the same logfile spam if you run ;yourProject/clean; yourProject/assets/assets ?

Yes, same thing with sbt assets:assets.

dwickern commented 7 months ago

Does conf/logback.xml exist? Without any logback config file, it will output everything.

bursauxa commented 7 months ago

That was it, adding conf/logback.xml removed the spam. We inject logback configurations during the pakcaging process (depending on target environment) but clearly this comes too late for the plugin. Thanks for the heads-up!