Skip to content

Commit dce5ecd

Browse files
Merge pull request #12107 from rabbitmq/mergify/bp/v3.13.x/pr-12105
Prevent exchange logging crash (backport #12104) (backport #12105)
2 parents 73b7388 + 090b33a commit dce5ecd

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

deps/rabbit/src/rabbit_logger_exchange_h.erl

+12-2
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,18 @@ log(#{meta := #{mfa := {?MODULE, _, _}}}, _) ->
4646
ok;
4747
log(LogEvent, Config) ->
4848
case rabbit_boot_state:get() of
49-
ready -> do_log(LogEvent, Config);
50-
_ -> ok
49+
ready ->
50+
try
51+
do_log(LogEvent, Config)
52+
catch
53+
C:R:S ->
54+
%% don't let logging crash, because then OTP logger
55+
%% removes the logger_exchange handler, which in
56+
%% turn deletes the log exchange and its bindings
57+
erlang:display({?MODULE, crashed, {C, R, S}})
58+
end,
59+
ok;
60+
_ -> ok
5161
end.
5262

5363
do_log(LogEvent, #{config := #{exchange := Exchange}} = Config) ->

0 commit comments

Comments
 (0)