Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(db): honors enable-db-debug flag when set to true #949

Conversation

machi1990
Copy link
Contributor

Description

The custom logger didn't print the sql statements which are useful during debugging. I ran into this
issue when testing something locally. Let's honor this flag by using the default logger that comes
with gorm to print the SQL statements.

Verification Steps

To verify the changes:

    1. Before this patch, build the binary and run ./kas-fleet-manager serve --enable-db-debug=true this wouldn't print the SQL statements
    1. Apply this patch locally, built the binary and run
      ./kas-fleet-manager serve --enable-db-debug=true and observe the
      printed SQL statements
    1. Disabe db debug by run ./kas-fleet-manager serve --enable-db-debug=false again with code changes on this patch and observe that no SQL statements are printed out

Checklist (Definition of Done)

  • [ ] All acceptance criteria specified in JIRA have been completed
  • [ ] Unit and integration tests added that prove the fix is effective or the feature works (tested against emulated and non-emulated OCM environment)
  • [ ] Documentation added for the feature There will be a troubleshooting guide and the usage of this flag might go there
  • [ ] CI and all relevant tests are passing
  • Code Review completed
  • Verified independently by reviewer
  • [ ] Required metrics/dashboards/alerts have been added (or PR created).
  • [ ] Required Standard Operating Procedure (SOP) is added.
  • [ ] JIRA has created for changes required on the client side

@machi1990 machi1990 force-pushed the fix/ensure-logs-are-there-in-debug branch from 22e6762 to 81bc09f Compare April 25, 2022 09:54
@machi1990 machi1990 requested a review from a team as a code owner April 25, 2022 09:54
The custom logger didn't print the sql statements which are useful during debugging. I ran into this
issue when testing something locally. Let's honor this flag by using the default logger that comes
with gorm to print the SQL statements.

To verify the changes:

- 1. Before this patch, build the binary and run `./kas-fleet-manager
serve --enable-db-debug=true` this wouldn't print the SQL statements
- 2. Apply this patch locally, built the binary and run
`./kas-fleet-manager serve --enable-db-debug=true` and observe the
printed SQL statements
- 3. Disabe db debug by run `./kas-fleet-manager serve --enable-db-debug=false` again with code changes on this patch and observe that no SQL statements are printed out
@machi1990 machi1990 force-pushed the fix/ensure-logs-are-there-in-debug branch from 81bc09f to 4af99a5 Compare April 25, 2022 11:35
Copy link
Contributor

@Rajagopalan-Ranganathan Rajagopalan-Ranganathan left a comment

Choose a reason for hiding this comment

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

/lgtm

@machi1990
Copy link
Contributor Author

Thanks @Rajagopalan-Ranganathan for the review and approval. Let's get this in as I might need to cherry-pick this into factorized fleet manager template.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants