-
Notifications
You must be signed in to change notification settings - Fork 9.6k
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
Separate loggers #26685
Separate loggers #26685
Conversation
Added an Off level to hclog, so we can individually disable logging at various levels. Added IndependentLevels so that sublogger levels are not linked to their parents.
Codecov Report
|
43e1ca6
to
22f753a
Compare
Now that hclog can independently set levels on related loggers, we can separate the log levels for different subsystems in terraform. This adds the new environment variables, `TF_LOG_CORE` and `TF_LOG_PROVIDER`, which each take the same set of log level arguments, and only applies to logs from that subsystem. This means that setting `TF_LOG_CORE=level` will not show logs from providers, and `TF_LOG_PROVIDER=level` will not show logs from core. The behavior of `TF_LOG` alone does not change. While it is not necessarily needed since the default is to disable logs, there is also a new level argument of `off`, which reflects the associated level in hclog.
f598cbc
to
eb2d443
Compare
This is SO AWESOME this PR needs some PR; everyone needs to see how cool it is. |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
Both core and provider logs can be quite verbose, and it is often difficult to debug one or the other while sifting through the combination of their logs.
Here we introduce two new environment variables for more control over logging:
The existing
TF_LOG
environment variable remains to set the global log level, but these new variables allow the viewing of the subsystem logs independently.