TF_LOG_PROVIDER_{NAME} does not work

I’m developing a custom provider named “maven”, and I would like to filter logs only from my provider.
I followed the instruction in Home - Plugin Development: Managing Log Output | Terraform by HashiCorp, and then I set the environment variable TF_LOG_PROVIDER_MAVEN=trace but no log is shown.
What am I missing?

Hi @kota65535,

It looks like the docs on that page could be improved a bit. Those logging options only serve to limit output from provider using the referenced libraries for logging. The Terraform CLI only knows about TF_LOG, TF_LOG_CORE and TF_LOG_PROVIDER.

You can try combining that with TF_LOG_PROVIDER=trace, but since other providers may be using the legacy logging system you will still see them in the logs. In that case it’s probably just easiest to filter the logs by the actual provider executable name as shown the log lines. While logs are relatively easy to filter as text, you also have the option of TF_LOG=json and using the structured output too.

Hi @jbardin,

Thank you for the explanation! I’ve tried combining with TF_LOG_PROVIDER=trace and ended up seeing logs of other providers because there are few of them using the referenced logging libraries.
As you say, it seems easier to redirect all stderr output and then filter them with grep.