code-anth

code-anth

Hiya. I’m trying to switch from LoggerFileBackend to Erlang/OTP Handlers for logging. In the Elixir Logger docs, it says:

At the moment, there is no built-in overload protection for Erlang handlers, so it is your responsibility to implement it.

However, in the Erland docs it says:

The default handlers, logger_std_h and logger_disk_log_h, feature an overload protection mechanism, which makes it possible for the handlers to survive, and stay responsive, during periods of high load (when huge numbers of incoming log requests must be handled)

This sounds a bit ambiguous to me. Would anyone be able to clarify this?
Thanks!

Showing Posts 1 to 10

D4no0

D4no0

The elixir library doesn’t implement overload protection, however if you use erlang logger backend, the backend will have overload protection?

Does that make sense? I am not entirely familiar with logger backends, but it seems that should be the principle.

code-anth

code-anth OP

Thanks for the quick reply, it does make a bit more sense.

However, I first read “built-in” as meaning “there is no built-in overload protection in Erlang” and not as “there is no built-in overload protection in Elixir anymore.”

You know what I mean?

D4no0

D4no0

Yeah, the choice of wording is strange indeed, maybe there is something more to it.

It might also be that erlang did not have overloading protection back in the day when this was written down in elixir documentation, but this is just a theory.

I guess you have to wait for a elixir core member to answer.

code-anth

code-anth OP

Thanks, @D4no0 , I appreciate the effort.
I’ll wait for a core member to answer.

hubertlepicki

hubertlepicki

also, even if you’re using the erlang backend you should test what happens when you go overboard. I think we had to change the settings to accomodate the issue when a log drain on Pod was blocking, and with the default settings the Erlang/Phoenix app still locked up because of this completely. This was not the most recent OTP and I know there were logger changes but you should not just rely on the fact that it has overload protection, you should check how it works and behaves in your set up and it’s one of the things you may want to tweak otherwise the total system collapse is very much possible :wink:

dimitarvp

dimitarvp

Is it truly that bad? When you drain requests from a pod that’s shutting down that is (unless I misread you)?

hubertlepicki

hubertlepicki

Well, yes, overload protection and ensuring the handlers survive is one thing, the other thing is how the system behaves and if it survives when the output of logs exceedes the capacity to process them.

Logger has several options to handle that situation, the ones you may want to tweak are :sync_threshold, :discard_threshold and :max_buffer.

Basically we had situation where logger was switching to sync mode, and stayed in it too long, the I/O was stuck and we just decided never to do it because the whole system would freeze, and switched to discard mode instead of ever hitting sync mode was the best option for us.

dimitarvp

dimitarvp

Good to know, thanks for indulging. I suppose I was under the illusion that having a maximum buffer and discarding under load were the defaults.

code-anth

code-anth OP

Thanks for that conversation, @dimitarvp and @hubertlepicki. It definitely sounds like discarding under load and having a maximum buffer should be defaults.

In any case, going back to the original question, it does sound like handlers DO have some overload protection and one needs to test how to tweak it.

hubertlepicki

hubertlepicki

If I am reading the documentation right, the Logger will switch to sync mode after 20 messages in the buffer, then will wait for 480 more messages before it switches to discard mode. On the nodes that are not doing a lot of logging that means these requests are stuck for that time.

Where Next? Top

Trending in Questions Top

RSP87
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
nseaSeb
Hello, I know there is an approach for handling lists that allows for optimized traversal, but I can’t recall the specific method (somet...
New
kpanic
Hi everyone, I am toying with the idea of building a “match maker” for giving personal help to people that wants to start coding. I sta...
New
brecabral
Documentation While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
velrest
So my question is quite simple and i have found no conclusive answer on forum, google or AI. Should we use :erlang.float for Integer to ...
New
asweet-confluent
I recently noticed that Elixir’s Logger defaults its primary log level to :debug when no :logger, :level application configuration is pre...
New
apz
I’m new to elixir and just tried to install the elixirLS extension for VScode(ium) and it is throwing some errors that I would like help ...
New

Other Trending Topics Top

GenericJam
Edit: 2026 May 15 - This post is archived. Mob is alive!! Main docs: mob v0.7.11 — Documentation A bit of explanation for the slightly c...
New
JesseHerrick
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, it’s a Python-based wor...
New
mhanberg
Hi everyone! The first release candidate for the Expert language server project is now available! We’ve published a press release detai...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews