<div dir="ltr">With logger (OTP-21.x) you can use process metadata and a filter. For example, in your process' init function, call: <br>logger:set_process_metadata(#{dont_log=>true}).<div><br></div><div>Then add a filter which checks for this meta and stops the log - something like: <br>logger:add_primary_filter(my_filter_id,{fun(#{meta:=#{dont_log:=true}}) -> stop; (_,_) -> ignore end,ok}).</div><div><br></div><div>This will turn off all logs issued from the process itself, that is, the termination report from gen_server, the crash report from proc_lib, and any other log issued with the logger API.</div><div><br></div><div>It will, however, not turn off the logs issued by the emulator after the process has crashed, i.e. the error report saying "Error in process <...> with exit reason ..." The reason for this is that the emulator has no knowledge of the process metadata, and can not include it in the log event. Therefore, to turn off these messages, you need a filter which can recognize the pid (which is still part of the metadata in this error report). But this is no problem if we're only talking about gen_server processes, since the emulator does not issue error reports for such processes.</div><div><br></div><div>Best Regards</div><div>/siri</div><div><br></div><div><br></div><div><br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr">Den tir. 11. sep. 2018 kl. 09:50 skrev Frank Muller <<a href="mailto:frank.muller.erl@gmail.com" target="_blank">frank.muller.erl@gmail.com</a>>:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto">Hi,</div><div dir="auto"><br></div><div dir="auto">I found this old thread: is there a way to prevent a crashing process from sending a message to error_logger?</div><div dir="auto"><br></div><div><a href="http://erlang.org/pipermail/erlang-questions/2017-September/093407.html" target="_blank">http://erlang.org/pipermail/erlang-questions/2017-September/093407.html</a></div><div dir="auto"><br></div><div dir="auto">but I’m wondering if there is a documented, non-documented or even a hackish way to disable error reports for certain (gen_server) processes (Erlang 20.x or 21.x)?</div><div dir="auto"><br></div><div dir="auto">Thanks for you help/feedbacks</div><div dir="auto">/Frank</div>
_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org" target="_blank">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" rel="noreferrer" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
</blockquote></div>