Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Overhaul logging behavior #173

Closed
Histalek opened this issue Sep 15, 2021 · 3 comments
Closed

feat: Overhaul logging behavior #173

Histalek opened this issue Sep 15, 2021 · 3 comments
Labels
feature New feature or request good first issue Good for newcomers

Comments

@Histalek
Copy link

Current behavior

Gatus spams the journal with errors (priority=3, log-level=error) as every message from Gatus is logged the same way.

I'm running Gatus in a container with podman and the journald logging driver.

Expected behavior

Log messages from Gatus are logged with an appropriate log-level. Not spamming the journal with error messages that are essentially no errors.

Proposition

  1. Log output to stdout and log diagnostic information about Gatus itself to stderr
  2. Give every log message proper log-levels

Reasoning and other comments

The current behavior is most likely caused by logging everything to stderr without explicitly setting a log-level/priority (log.go does this by default).

IMO stderr should be used for diagnostic information, e.g. listening address, database connection, configuration changes and validation, anything needed to possibly oversee the operation of Gatus itself.
Watchdog messages should then instead be logged to stdout, because these messages are more likely the output of Gatus and should be handled as such.
Especially for watchdog messages i'd like to see INFO for successful checks and WARN for unsuccessful checks as the log-level.

I'm not sure if all of this is possible with log.go, maybe something like logrus, zerolog or zap would be more suitable.

@TwiN
Copy link
Owner

TwiN commented Oct 9, 2022

We could just resolve this by setting log.SetOutput(os.Stdout). By default, log uses os.Stderr.

@TwiN TwiN changed the title Feature Request: Overhaul logging behavior feat: Overhaul logging behavior Oct 9, 2022
@TwiN TwiN added the feature New feature or request label Oct 9, 2022
@jangrewe
Copy link

@TwiN To chime in on this, i'd really like to disable the output of regular checks, as >200 checks creates quite a bit of log output. ;-)

@TwiN TwiN added the good first issue Good for newcomers label Dec 23, 2023
@TwiN
Copy link
Owner

TwiN commented Nov 20, 2024

@jangrewe @Histalek this has been resolved by #872 and #895. Not released yet, but it's available under the latest tag.

A bit late, but better late than never.

@TwiN TwiN closed this as completed Nov 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants