Prevent exchange logging crash
Don't let the `log` callback of exchange_logging handler crash, because in case of a crash OTP logger removes the exchange_logger handler, which in turn deletes the log exchange and its bindings. It was seen several times in production that the log exchange suddenly disappears and without debug logging there is no trace of why. With this commit `erlang:display` will print the reason and stacktrace to stderr without using the logging infrastructure.
This commit is contained in:
parent
58d4e753ee
commit
34bcb91159
|
@ -44,7 +44,17 @@ log(#{meta := #{mfa := {?MODULE, _, _}}}, _) ->
|
|||
ok;
|
||||
log(LogEvent, Config) ->
|
||||
case rabbit_boot_state:get() of
|
||||
ready -> do_log(LogEvent, Config);
|
||||
ready ->
|
||||
try
|
||||
do_log(LogEvent, Config)
|
||||
catch
|
||||
C:R:S ->
|
||||
%% don't let logging crash, because then OTP logger
|
||||
%% removes the logger_exchange handler, which in
|
||||
%% turn deletes the log exchange and its bindings
|
||||
erlang:display({?MODULE, crashed, {C, R, S}})
|
||||
end,
|
||||
ok;
|
||||
_ -> ok
|
||||
end.
|
||||
|
||||
|
|
Loading…
Reference in New Issue