Skip to content

RSDK-10518: Support setting globalLogger's level from config file #4984

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

aldenh-viam
Copy link
Contributor

@aldenh-viam aldenh-viam commented May 13, 2025

In the configuration file:

"debug": true
or
"log": [ { "pattern": "*", "level": "debug", } ]
will now display DEBUG logs for modules. Note the latter updates through config.go:UpdateLoggerRegistryFromConfig and appears to work fine as-is.

Currently, this is only available when running viam-server with -debug because:
RunServer calls config.InitLoggingSettings(logger, argsParsed.Debug):

InitLoggingSettings calls both logging.GlobalLogLevel.SetLevel and logger.SetLevel.

The refreshLogLevelInLock is called after configs are read (both initially and when updated) and is missing the logger.SetLevel update.

@aldenh-viam aldenh-viam requested a review from a team May 13, 2025 18:54
@viambot viambot added the safe to test This pull request is marked safe to test from a trusted zone label May 13, 2025
Copy link
Member

@benjirewis benjirewis left a comment

Choose a reason for hiding this comment

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

Does this fix the issue described in RSDK-10518? If so, do you know why? What does globalLogger.logger.SetLevel do that logging.GlobalLogLevel.SetLevel does not?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
safe to test This pull request is marked safe to test from a trusted zone
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants