Initialize logger with prom config from flags#13
Conversation
|
@brennantaylor thank you so much; this one was driving me somewhat nuts and I couldn't figure out where the breakage was. |
|
@brennantaylor |
|
Interesting I was just testing json. I'll take a peek at the log levels. Without my patch: With my patch json formatting turns on. |
|
I poked around a bit but found nothing obvious. The |
|
Oh I think I figured it out.
I believe So just a library mixup. I'll try changing |
This addresses two problems.
First it looks like the logger is initialized with an empty config, then
a different config is passed into kingpin to be filled up from the
command line arguments.
This change re-initializes the logger with the prom config parsed by
kingpin so that `--log.level` and `--log.format` populate the promlog
instance as expected.
The second issue is that there are 2 go-kit logging libraries.
The smaller `go-kit/log` and `go-kit/kit/log`.
`promlog` is using the smaller `go-kit/log` so `pgpool2_exporter` has
been updated to use the same. Otherwise we were using different
instances of the level types which means the following type assertion
would fail inside the filtered logger since the level is from the other
package:
```go
if v, ok := keyvals[i].(*levelValue); ok {
```
33dfcc4 to
1069e32
Compare
|
@pengbo0328 I pushed the changes, you should see that both |
|
@pengbo0328 Just letting you know this is ready for you to take another look at. |
|
@brennantaylor |
It looks like the logger is initialized with an empty config, then a different
config is passed into kingpin to be filled up from the command line arguments.
This change re-initializes the logger with the prom config parsed by kingpin so
that
--log.leveland--log.formatwork as documented.