hashicorp / terraform-exec

Terraform CLI commands via Go.
https://pkg.go.dev/github.com/hashicorp/terraform-exec
Mozilla Public License 2.0
684 stars 114 forks source link

Unable to set log level without writing to file #436

Open wandergeek opened 10 months ago

wandergeek commented 10 months ago

Hey there legends! 👋

I'm trying to set TF_LOG using tf.SetLog("TRACE") and I am not getting any TRACE logging unless I also set the TF_LOG_PATH. Looking closer at the code, it looks like this is expected behavior? https://github.com/hashicorp/terraform-exec/blob/main/tfexec/cmd.go#L154-L166

Is there a way I can get TRACE logging without having to set the log path as well?

Cheers, Nick

wandergeek commented 10 months ago

Even weirder, when I use SetLogPath to set the logging destination file, I don't actually get a file out. Taking a stab in the dark, maybe this has something to do with overwriting the logging destinations? https://github.com/hashicorp/terraform-exec/blob/e26205510919b4f893bb1370e000835b5d16ae4d/tfexec/cmd_default.go#L27-L45