Skip to content

Fix interactive SQL logging in debug mode#801

Open
RedZapdos123 wants to merge 1 commit into
uyuni-project:mainfrom
RedZapdos123:fix-418-interactive-sql-logging
Open

Fix interactive SQL logging in debug mode#801
RedZapdos123 wants to merge 1 commit into
uyuni-project:mainfrom
RedZapdos123:fix-418-interactive-sql-logging

Conversation

@RedZapdos123

@RedZapdos123 RedZapdos123 commented Jun 1, 2026

Copy link
Copy Markdown

What does this PR change?

Issue #418 reported that mgradm support sql -i --logLevel debug could corrupt the interactive SQL output because debug logs were written to the same terminal used by psql.

This PR updates the mgradm root logger initialization to disable console logging only for interactive support sql sessions when the log level is debug or trace, preserving file logging and keeping the existing console logging behavior for other commands.

It also adds regression tests that cover the logging decision for interactive and non-interactive support sql.

Closes #418.

Codespace

Check if you already have a running container clicking on Running CodeSpace

Create CodeSpace About billing for Github Codespaces CodeSpace Billing Summary CodeSpace Limit

Test coverage

  • Unit tests were added.

  • The changes were reviewed manually.

  • Formatting checks were run using gofmt -w mgradm/cmd/cmd.go mgradm/cmd/cmd_test.go.

  • Focused tests were run using go test ./mgradm/cmd/....

  • The full build was run using go build ./....

  • The full test suite was run using go test ./....

  • Additional verification was run in Docker using go build ./... && go test ./....

  • The interactive reproduction was verified manually using mgradm support sql -i --backend kubectl --logLevel debug.

  • DONE

Validation screenshots

Focused tests run locally:

image image

Before the fix

image

After the fix

image

Links

Issue(s): #418

  • DONE

Changelogs

No changelog needed because this is a narrow debug-mode interactive terminal fix in uyuni-tools, not a release-note level user-facing change.

Make sure the changelogs entries you are adding are compliant with https://github.com/uyuni-project/uyuni/wiki/Contributing#changelogs and https://github.com/uyuni-project/uyuni/wiki/Contributing#uyuni-projectuyuni-repository

If you don't need a changelog check, please mark this checkbox:

  • No changelog needed

If you uncheck the checkbox after the PR is created, you will need to re-run changelog_test (see below)

Before you merge

Check How to branch and merge properly!

@RedZapdos123 RedZapdos123 force-pushed the fix-418-interactive-sql-logging branch from 24c79d5 to 18a527a Compare June 17, 2026 14:47
@RedZapdos123 RedZapdos123 reopened this Jun 17, 2026
@RedZapdos123

Copy link
Copy Markdown
Author

Now the commit is signed.

Signed-off-by: Mridankan Mandal <xerontitan90@gmail.com>
@RedZapdos123 RedZapdos123 force-pushed the fix-418-interactive-sql-logging branch from e0df6df to 62d10b4 Compare June 18, 2026 12:55
@sonarqubecloud

Copy link
Copy Markdown

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.

Interactive sql with log level misformatting output

1 participant