Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I turn off the verbose logging in swagger-codegen?

I upgraded to swagger-codegen 3.0.10, and all of a sudden there's a ton of debugging output to the screen. There seems to be no command-line option to turn it off.

Does anyone know how to turn off the debugging output?

like image 352
BooTooMany Avatar asked Jan 31 '26 06:01

BooTooMany


1 Answers

Figured it out. Swagger-codegen uses Logback for logging, and so we need to change its config file.

Step 1: Create a file logback.xml with the following content:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
   <logger name="io.swagger" level="warn"/>
</configuration>

Step 2: swagger-codegen is actually a script that invokes java with the appropriate jar. You can edit the command (or invoke java directly from the command line) and include the following in the command line:

-Dlogback.configurationFile=./logback.xml

assuming logback.xml file is in your local directory. Of course, change the path if it's in a different directory.

For example:

java -Dlogback.configurationFile=./logback.xml -jar /usr/local/Cellar/swagger-codegen/3.0.10/libexec/swagger-codegen-cli.jar ...[other options]

This will turn off the verbose output. You can set other levels as you like - just replace 'warn' in the logback.xml file.

like image 196
BooTooMany Avatar answered Feb 02 '26 09:02

BooTooMany



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!