Skip to content

Commit e60d512

Browse files
Merge pull request #12105 from rabbitmq/mergify/bp/v4.0.x/pr-12104
Prevent exchange logging crash (backport #12104)
2 parents 8970eee + 2d2e79d commit e60d512

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

deps/rabbit/src/rabbit_logger_exchange_h.erl

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

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

0 commit comments

Comments
 (0)