Skip to content

Provide some more pointers for logger overload protection #13855

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

Merged
merged 2 commits into from
Sep 24, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions lib/logger/lib/logger.ex
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,12 @@ defmodule Logger do
* Formats and truncates messages on the client
to avoid clogging `Logger` handlers.

* Alternates between sync and async modes to remain
performant when required but also apply back-pressure
when under stress.
* Provides multiple forms of [overload protection](https://www.erlang.org/doc/apps/kernel/logger_chapter.html#protecting-the-handler-from-overload):
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The line is too long, unsure how to break it up or if there's a better way to link to it - but I found calling out the specific chapter for details valuable.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's fine, no worries!

* keeps track of its message queue and switches to sync mode to apply
back pressure or even drop messages
* limits the number of logs emitted defaulting to 500 per second
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm unsure what level of detail to provide as defaults may change, however I found it surprising how compartively low this limit is and so I found it worth calling out

* optionally allows to terminate & restart it if message queue length
or memory thresholds are exceeded

* Allows overriding the logging level for a specific module,
application or process.
Expand Down
Loading