Skip to content
This repository has been archived by the owner on Aug 23, 2023. It is now read-only.

Init Logger before Configs #825

Merged
merged 1 commit into from
Jan 22, 2018
Merged

Conversation

Aergonus
Copy link
Contributor

The project attempts to use the logger before it's initialized.
For example, it would never print out log.Fatal(4, "error with configuration file: %s", err) and merely exit. Additionally the logger is used in loading configs meaning they silently fail.

The user specified logging levels are applied after configs are parsed.
golang's init function runs first so log-level will be parsed already

oopsie fixed from #823

The project attempts to use the logger before it's initialized.
For example, it would never print out log.Fatal(4, "error with configuration file: %s", err) and merely exit. Additionally the logger is used in loading configs meaning they silently fail.

The user specified logging levels are applied after configs are parsed.
golang's init function runs first so log-level will be parsed already
@Dieterbe Dieterbe merged commit 3e35e99 into grafana:master Jan 22, 2018
@Aergonus Aergonus deleted the bugfix/init-logging branch January 22, 2018 17:18
@Dieterbe Dieterbe mentioned this pull request Aug 15, 2018
beorn- pushed a commit to beorn-/metrictank that referenced this pull request Nov 27, 2018
as of grafana#823/grafana#825, the logger was created before flags were parsed
and the config (file and env vars) were loaded.
so the logger would always get the default value for the flag
and no way to change the level..
I tried creating the logger after flag parsing, and adjusting the log
level after config parsing, but couldn't the second step to work
properly.

Simplest solution is to just print to stderr directly the one time we
actually need it in between the two steps.

PS: I hate this logging library, but we'll get rid of it. see grafana#624
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants