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

Lower logging level of an error #481

Open
dpc opened this issue Mar 7, 2025 · 2 comments
Open

Lower logging level of an error #481

dpc opened this issue Mar 7, 2025 · 2 comments

Comments

@dpc
Copy link

dpc commented Mar 7, 2025

log_error!(logger, "Failed to retrieve fee rate estimates: {}", e);

In our dev environment, where regtest is used, this log line spams the log outputs with an error logging level, despite being completely harmless and unimportant.

Good opportunity to discuss my pet peeve: "error logging level" is a misnomer, and tragically it compels developers to log everything that looks like an "error" with "error logging level".

Since log levels are supposed to be ... well... levels, they come with an increased severity/importance. In most higher level software most "errors" are completely unimportant and expected, and do not deserve "error logging level". I generally recommend not using the name "error level" at all, or internally rename it to a "fault", "severe" or "important", just to remind developers "error" != "error logging level".

  • tracing - for debugging what the program is doing, trying to trace which code paths were taken
  • debug - for normal debugging why something is not working
  • info - for messages that end user might want to know, which are not problems
  • warning - for things that the user should check on when they notice them, as they might be problems
  • error (aka important) - for things the is a clear sign the app is malfunctioning and needs urgent attention
  • critical (if distinct from previous one, when available in certain logging frameworks) - basically panic that shut down the app
@tnull
Copy link
Collaborator

tnull commented Mar 13, 2025

In our dev environment, where regtest is used, this log line spams the log outputs with an error logging level, despite being completely harmless and unimportant.

No, it's not 'completely harmless and unimportant'. Prolonged failure to update fee rates can have severe consequences in Lightning, for example leading to feerate disagreements with the counterparty and force-closures. So periodically retrieving current fee rates is vital for the correct operation of a Lightning node, which is why we log this as error, and even enforce a successful fee rate cache update on startup. If this is spamming your logs, you need to figure out why it fails and fix your chain source.

Good opportunity to discuss my pet peeve: "error logging level" is a misnomer, and tragically it compels developers to log everything that looks like an "error" with "error logging level".

Thank you for the explainer on log levels.

@dpc
Copy link
Author

dpc commented Mar 13, 2025

Prolonged failure

Prolonged is the keyword. A single failure is 'completely harmless and unimportant'.

An error could be printed when the fee rates are stale not every time the call failed. Otherwise every brief transient error lead to error level logs, which is operationally exhausting.

If someone wants to e.g. get a text message whenever their production services need attention, doing it on log level basis is a natural approach. But for that to work well, messages that are printed at highest logging levels need to be actually important, not just "maybe, kind of in the area that is important".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants