Skip to content

Log global property-enabled output at info level (#25827) - #25830

Open
apteryks wants to merge 2 commits into
OpenAPITools:masterfrom
apteryks:fix-printing-of-debug-models
Open

apteryks wants to merge 2 commits into
OpenAPITools:masterfrom
apteryks:fix-printing-of-debug-models

Conversation

@apteryks

@apteryks apteryks commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Previously, the output would not be shown as json.prettyPrint logs at
debug level via the swagger logger, which level is hard-coded to
use the warn level.

Fixes: #25827

PR checklist

[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.965 s <<< FAILURE! -- in org.openapitools.codegen.plugin.CodeGenMojoTest
[ERROR] org.openapitools.codegen.plugin.CodeGenMojoTest.testCommonConfigurationWithRemoteInputSpec -- Time elapsed: 0.964 s <<< ERROR!
org.apache.maven.plugin.MojoExecutionException: Code generation failed. See above for the full exception.
at org.openapitools.codegen.plugin.CodeGenMojo.execute(CodeGenMojo.java:1137)
at org.openapitools.codegen.plugin.CodeGenMojoTest.testCommonConfiguration(CodeGenMojoTest.java:79)
at org.openapitools.codegen.plugin.CodeGenMojoTest.testCommonConfigurationWithRemoteInputSpec(CodeGenMojoTest.java:73)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at junit.framework.TestCase.runTest(TestCase.java:177)
at junit.framework.TestCase.runBare(TestCase.java:142)
at junit.framework.TestResult$1.protect(TestResult.java:122)
at junit.framework.TestResult.runProtected(TestResult.java:142)
at junit.framework.TestResult.run(TestResult.java:125)
at junit.framework.TestCase.run(TestCase.java:130)
at junit.framework.TestSuite.runTest(TestSuite.java:241)
at junit.framework.TestSuite.run(TestSuite.java:236)

./bin/generate-samples.sh ./bin/configs/*.yaml -> OK
./bin/utils/export_docs_generators.sh -> OK

<!-- This is an auto-generated description by cubic. -->
---
## Summary by cubic
Makes debug output from global properties like `debugModels=true` actually visible by printing it at info level. Previously `Json.prettyPrint` logged through the `io.swagger` logger, whose level was hardcoded to `warn`, so the output was suppressed.

- Replaces `Json.prettyPrint` with `LOGGER.info(Json.pretty(...))` for models, APIs, webhooks, and supporting files.
- Documents that when invoking the tool via Java directly, options must be passed on the command line rather than via `JAVA_OPTS`.

Fixes #25827.

<sup>Written for commit 998d8d932e6436975f264b698bcdbd861b1ff7f5. Summary will update on new commits.</sup>

<a href="https://cubic.dev/pr/OpenAPITools/openapi-generator/pull/25830?utm_source=github" target="_blank" rel="noopener noreferrer" data-no-image-dialog="true"><picture><source media="(prefers-color-scheme: dark)" srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img alt="View guided diff" src="https://www.cubic.dev/buttons/review-in-cubic-light.svg"></picture></a>

<!-- End of auto-generated description by cubic. -->

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 2 files

Reply with feedback, questions, or to request a fix.

View guided diff | Re-trigger cubic

Comment thread docs/debugging.md Resolved
Comment thread docs/debugging.md Resolved
@apteryks

Copy link
Copy Markdown
Contributor Author

One thing I'm not overly fond of still is that the models debug output is drowned in lots of debug output, which makes it hard to find. I wonder if Json.prettyPrint shouldn't output on some other log level, or have it return the string to print manually instead, to avoid the logger configuration issue?

@apteryks
apteryks force-pushed the fix-printing-of-debug-models branch from 5a45341 to acffab1 Compare November 26, 2026 08:48

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 1 file (changes from recent commits).

Reply with feedback, questions, or to request a fix.

View guided diff | Re-trigger cubic

Comment thread docs/debugging.md Resolved
@apteryks
apteryks force-pushed the fix-printing-of-debug-models branch 3 times, most recently from 6f7bcf5 to 3127cd5 Compare November 27, 2026 00:54
Document that the Java properties must be provided directly on the
command-line when using java directly and not simply exported via
JAVA_OPTS.
Previously, the output would not be shown as json.prettyPrint logs at
debug level via the swagger logger, which level is hard-coded to
use the warn level.

Fixes: OpenAPITools#25827
@apteryks
apteryks force-pushed the fix-printing-of-debug-models branch from 3127cd5 to 998d8d9 Compare November 27, 2026 00:55
@apteryks apteryks changed the title logging: Set the log level of io.swagger dynamically. Log global property-enabled output at info level (#25827) Nov 27, 2026
@apteryks

Copy link
Copy Markdown
Contributor Author

I've revisited this and landed a better fix; there's no longer any need to change the default logging level; the output of global properties such as debugModels is now logged via openapi-generator-cli's own logger at the info level, instead of going through the swagger logger.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] debugModels=true not printing any model output

1 participant