Hi @alexhung Thank you for raising this and sorry you ran into trouble here. Is the code you are using publicly available? If so, that would be great to see.
Otherwise to try and help without that context, here are some troubleshooting things to check:
Ensuring your github.com/hashicorp/terraform-plugin-sdk and/or github.com/hashicorp/terraform-plugin-framework (if using) Go dependencies are up to date
If using terraform-plugin-sdk, that the provider logic is using context-aware functions, such as CreateContext or CreateWithoutTimeout. terraform-plugin-log requires that previously setup context to operate correctly.
That the provider logic is not creating a separate context, e.g. context.Background() or context.TODO() before passing it to terraform-plugin-log.
Turns out I didn’t have the latest terraform-plugin-sdk when I started the work. I was running 2.7.0 and after not able to get logging working, I shelved the branch and worked on another feature.
In this change, I updated the module to 2.14.0 so when I just now go back to the logging branch and update it, now it is running latest. And the logging works!