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

Support to modify verbose log level for mudules #538

Closed
acelyc111 opened this issue Apr 9, 2020 · 1 comment
Closed

Support to modify verbose log level for mudules #538

acelyc111 opened this issue Apr 9, 2020 · 1 comment

Comments

@acelyc111
Copy link

Now we have supportted to modify global log level by google::SetCommandLineOption("minloglevel", new_level), but in some cases, we want to modify log level for some mudules, but it's not supprtted now.

#if defined(__GNUC__)
// We emit an anonymous static int* variable at every VLOG_IS_ON(n) site.
// (Normally) the first time every VLOG_IS_ON(n) site is hit,
// we determine what variable will dynamically control logging at this site:
// it's either FLAGS_v or an appropriate internal variable
// matching the current source file that represents results of
// parsing of --vmodule flag and/or SetVLOGLevel calls.
#define VLOG_IS_ON(verboselevel)                                \
  __extension__  \
  ({ static google::int32* vlocal__ = &google::kLogSiteUninitialized;           \
     google::int32 verbose_level__ = (verboselevel);                    \
     (*vlocal__ >= verbose_level__) &&                          \
     ((vlocal__ != &google::kLogSiteUninitialized) ||                   \
      (google::InitVLOG3__(&vlocal__, &FLAGS_v,                         \
                   __FILE__, verbose_level__))); })
#else
// GNU extensions not available, so we do not support --vmodule.
// Dynamic value of FLAGS_v always controls the logging level.
#define VLOG_IS_ON(verboselevel) (FLAGS_v >= (verboselevel))
#endif

Accordding to these code, when VLOG_IS_ON is called at the first time, vlocal__ will be initialized as a non-google::kLogSiteUninitialized pointer, then we will use it forever, that means mudule verbose log level is immutable forever.
On production environment, sometimes we need some more verbose logging, but reset -vmodule and restart process is unacceptable, can we support to modify verbose log level for mudules?

@sergiud
Copy link
Collaborator

sergiud commented Mar 30, 2021

Is this still an issue? kLogSiteUninitialized was removed in 4a82a85.

@sergiud sergiud closed this as completed Apr 9, 2021
@sergiud sergiud mentioned this issue May 6, 2021
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

No branches or pull requests

2 participants