diff options
-rw-r--r-- | src/rabbit.erl | 8 | ||||
-rw-r--r-- | src/rabbit_error_logger.erl | 13 |
2 files changed, 16 insertions, 5 deletions
diff --git a/src/rabbit.erl b/src/rabbit.erl index eae3b802..3724c32e 100644 --- a/src/rabbit.erl +++ b/src/rabbit.erl @@ -161,7 +161,12 @@ -rabbit_boot_step({log_relay, [{description, "error log relay"}, - {mfa, {rabbit_error_logger, boot, []}}, + {mfa, {rabbit_sup, start_child, + [rabbit_error_logger_lifecycle, + supervised_lifecycle, + [rabbit_error_logger_lifecycle, + {rabbit_error_logger, start, []}, + {rabbit_error_logger, stop, []}]]}}, {requires, routing_ready}, {enables, networking}]}). @@ -443,7 +448,6 @@ start(normal, []) -> end. stop(_State) -> - terminated_ok = error_logger:delete_report_handler(rabbit_error_logger), ok = rabbit_alarm:stop(), ok = case rabbit_mnesia:is_clustered() of true -> rabbit_amqqueue:on_node_down(node()); diff --git a/src/rabbit_error_logger.erl b/src/rabbit_error_logger.erl index 184dcf17..17ed8563 100644 --- a/src/rabbit_error_logger.erl +++ b/src/rabbit_error_logger.erl @@ -22,7 +22,7 @@ -behaviour(gen_event). --export([boot/0]). +-export([start/0, stop/0]). -export([init/1, terminate/2, code_change/3, handle_call/2, handle_event/2, handle_info/2]). @@ -31,16 +31,23 @@ -ifdef(use_specs). --spec(boot/0 :: () -> 'ok'). +-spec(start/0 :: () -> 'ok'). +-spec(stop/0 :: () -> 'ok'). -endif. %%---------------------------------------------------------------------------- -boot() -> +start() -> {ok, DefaultVHost} = application:get_env(default_vhost), ok = error_logger:add_report_handler(?MODULE, [DefaultVHost]). +stop() -> + terminated_ok = error_logger:delete_report_handler(rabbit_error_logger), + ok. + +%%---------------------------------------------------------------------------- + init([DefaultVHost]) -> #exchange{} = rabbit_exchange:declare( rabbit_misc:r(DefaultVHost, exchange, ?LOG_EXCH_NAME), |