hashicorp / hashicorp/go-plugin
Logs keys order is non deterministic
- Dominant language
- Go
- Stars
- 6.1k
- Forks
- 511
- Avg merge
- 22h 47m
- Merged PRs (30d)
- 4
Description
When using a `hclog` logger with json format in the plugin side and using json as format, the logs that will be output by the host will show the json keys in a non deterministic order.
For example, changing the `Greet` method from the `basic` example to:
```go
func (g *GreeterHello) Greet() string {
g.logger.Debug("message from GreeterHello.Greet")
for i := 0; i < 50; i++ {
g.logger.Debug("##msg from plugin##", "param1", 1, "param2", 2)
}
return "Hello!"
}
```
and running `./basic` will show lines like:
```sh
2023-07-31T11:53:11.727+0200 [DEBUG] plugin.greeter: ##msg from plugin##: param1=1 param2=2 timestamp=2023-07-31T11:53:11.727+0200
2023-07-31T11:53:11.727+0200 [DEBUG] plugin.greeter: ##msg from plugin##: param2=2 param1=1 timestamp=2023-07-31T11:53:11.727+0200
2023-07-31T11:53:11.727+0200 [DEBUG] plugin.greeter: ##msg from plugin##: param1=1 param2=2 timestamp=2023-07-31T11:53:11.727+0200
2023-07-31T11:53:11.727+0200 [DEBUG] plugin.greeter: ##msg from plugin##: param2=2 param1=1 timestamp=2023-07-31T11:53:11.727+0200
```
where the order of the log keys is not preserved
Contributor guide
Assessment
This issue has not been assessed yet.