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

Ensure tctl outputs all debug log messages #12807

Merged
merged 1 commit into from
May 25, 2022

Conversation

strideynet
Copy link
Contributor

@strideynet strideynet commented May 21, 2022

Closes #12801

Whilst tctl configures the global logger when -d is provided, it previously injected a utils.NewLogger() into components which use the cfg.Log field (as this is the default provided by service.MakeDefaultConfig() and this meant some debug log messages were not output. This change injects logrus.StandardLogger() into those components, so the configured log level/output rules take affect. See #12801 for an example of a log message that is not correctly output.

An alternative implementation would be to instantiate a new logger, and configure it the same as utils.InitLogger configures it. I'm also open to this is you consider that preferable.

@strideynet strideynet changed the title Ensure tctl outputs all debug log messages Ensure tctl outputs all debug log messages May 21, 2022
@github-actions github-actions bot added the tctl tctl - Teleport admin tool label May 21, 2022
Copy link
Contributor

@gabrielcorado gabrielcorado left a comment

Choose a reason for hiding this comment

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

LGTM. As an alternative, we could set the configuration default logger to the global one (currently, we're creating a new logger), which would make more sense to me, since we're always going to set this.

@strideynet
Copy link
Contributor Author

That would equally make sense to me, but I wasn't too sure if that was going to start causing unexpected behaviour elsewhere (e.g intentionally silenced log messages start being output), so I went with this implementation as it felt a bit less risky with my current knowledge of the codebase.

@strideynet strideynet enabled auto-merge (squash) May 25, 2022 15:03
@strideynet strideynet force-pushed the strideynet/tctl-debug-logging-fix branch from 7fbbc06 to 6eb2de8 Compare May 25, 2022 15:03
@strideynet strideynet force-pushed the strideynet/tctl-debug-logging-fix branch from 6eb2de8 to b54ac22 Compare May 25, 2022 16:30
@strideynet strideynet force-pushed the strideynet/tctl-debug-logging-fix branch from b54ac22 to 5248eeb Compare May 25, 2022 16:54
@strideynet strideynet merged commit 0591c59 into master May 25, 2022
@github-actions
Copy link

@strideynet See the table below for backport results.

Branch Result
branch/v7 Create PR
branch/v8 Create PR
branch/v9 Create PR

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

Successfully merging this pull request may close these issues.

tctl does not output all debug log messages when -d is provided
5 participants