erlang / otp

Erlang/OTP
http://erlang.org
Apache License 2.0
11.32k stars 2.94k forks source link

Add a log message when the logger enters burst protection mode #8852

Open PragTob opened 5 days ago

PragTob commented 5 days ago

Hi, it's me - logger documentation PR barrage guy :sweat_smile:

Is your feature request related to a problem? Please describe. I recently spent a lot of time trying to debug why our system had seemingly swallowed log messages. First of course I thought the application was broken for real. Anyhow, after reading the logger docs I figured we'd likely either hit :drop or :flush mode or maybe even the burst mode protection. I figured we hit drop mode (see #8849 ), but I was unsure if we had hit "burst protection mode". There is no log message that I'm aware of (checked the code) or any other way I could directly know that burst protection mode was turned on. So, I turned it off and hoped that this was it - but having the certainty before would have been good. As well as a way that I could have seen it while perusing the logs.

Describe the solution you'd like I'd like there to be a log emitted when burst mode protection is entered. I know it's one more log event to emit in an already high stress situation for the logger but I think the tradeoff is worth it.

I think it's also in line with a log message being emitted when :drop mode is entered.

Something like: Logger :default is entering burst protecting mode, dropping logs

Describe alternatives you've considered

Additional context Thank you for all your work on erlang and the new logger :green_heart:

PragTob commented 4 days ago

If we agree on a way to tackle this and it's a log message I'm confident I can also send a PR despite not being the best erlang programmer myself :) I have already read the burst limiting code in search for a log message and think I know where it should be emitted.