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

Update plugin logging to use tflog #419

Open
jcardinal opened this issue Dec 21, 2023 · 0 comments
Open

Update plugin logging to use tflog #419

jcardinal opened this issue Dec 21, 2023 · 0 comments

Comments

@jcardinal
Copy link

Terraform Version

terraform 1.5.7

Affected Resource(s)

Most or all

Repro Steps

  1. Create a situation that will cause a provider to log an event of WARN or ERROR level
  2. Run TF_LOG_PROVIDER=WARN TF_LOG_PATH=./tf.log terraform plan
  3. Review tf.log, notice the events are not shown

The issue is that we are using a deprecated logging pattern, and terraform encourages the use of their tflog package instead.

Expected Behavior

The log level specified by the provider should be understood correctly by terraform so filtering by log level works, and the user is not presenting with conflicting log levels.

Actual Behavior

We log all events as INFO level, while specifying our actual level as a string in the log message.

Steps to Reproduce

  1. Look at any logged event from the provider
  2. See the log level is INFO, regardless of what the provider specified using the log package, followed by the actual log level presented as a string at the beginning of the log message.

References

https://developer.hashicorp.com/terraform/plugin/log/writing

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

1 participant