summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/rabbit.erl3
-rw-r--r--src/rabbit_ra_logger.erl25
2 files changed, 28 insertions, 0 deletions
diff --git a/src/rabbit.erl b/src/rabbit.erl
index 0fdd0326cf..c182e7d10b 100644
--- a/src/rabbit.erl
+++ b/src/rabbit.erl
@@ -531,6 +531,9 @@ start_apps(Apps) ->
start_apps(Apps, RestartTypes) ->
app_utils:load_applications(Apps),
ensure_sysmon_handler_app_config(),
+ %% make Ra use a custom logger that dispatches to lager instead of the
+ %% default OTP logger
+ application:set_env(ra, logger_module, rabbit_ra_logger),
ConfigEntryDecoder = case application:get_env(rabbit, config_entry_decoder) of
undefined ->
[];
diff --git a/src/rabbit_ra_logger.erl b/src/rabbit_ra_logger.erl
new file mode 100644
index 0000000000..e023c53397
--- /dev/null
+++ b/src/rabbit_ra_logger.erl
@@ -0,0 +1,25 @@
+%% The contents of this file are subject to the Mozilla Public License
+%% Version 1.1 (the "License"); you may not use this file except in
+%% compliance with the License. You may obtain a copy of the License
+%% at http://www.mozilla.org/MPL/
+%%
+%% Software distributed under the License is distributed on an "AS IS"
+%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+%% the License for the specific language governing rights and
+%% limitations under the License.
+%%
+%% The Original Code is RabbitMQ.
+%%
+%% The Initial Developer of the Original Code is GoPivotal, Inc.
+%% Copyright (c) 2007-2019 Pivotal Software, Inc. All rights reserved.
+%%
+
+-module(rabbit_ra_logger).
+
+-export([
+ log/4
+ ]).
+
+log(Level, Format, Args, _Meta) ->
+ lager:log(Level, self(), Format, Args),
+ ok.