Custom logger handlers overload protection

I developed a logger handler that redirects JSON formatted logs to a remote server on the internet.
In the logger user’s guide there is mention of overload protection for the default logger handlers Erlang -- Logging .
Apparently this is implemented in the logger_olpmodule that is used by the logger_h_common callbacks. I read the code in logger_disk_log_h and the OLP management for the standard OTP handlers is provided by logger_h_common:log/2 that in turn calls logger_olp:load/2.

I was wondering whether by starting a logger_olp instance and directly calling logger_olp:load/2from a custom handler would be enough to provide the same kind of overload protection.
I would also provide the proper handling of stop/termination of the OLP server.

Do you think that using the undocumented OLP modules is feasible or that would be better to develop my own overload protection method?

If you’re implementing a custom logger handler then you’ll need custom code for its overload protection, if any. The one in OTP, logger_olp, is not a public API and it’s very closely integrated with OTP’s built-in logger handlers. Don’t use it.

If you’re studying logger_olp for inspiration, please use only very recent code due to logger's overload protection gets slower as its message queue length grows · Issue #7417 · erlang/otp · GitHub

1 Like

Thank you for the quick answer.
I guess I will Implement my own overload protection loosely based on the OTP one. The code I was looking at is from OTP 26, so I guess it adresses Issue #7417.