summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/rabbit.erl8
-rw-r--r--src/rabbit_error_logger_file_h.erl4
-rw-r--r--src/rabbit_sasl_report_file_h.erl4
-rw-r--r--src/rabbit_tests.erl2
4 files changed, 13 insertions, 5 deletions
diff --git a/src/rabbit.erl b/src/rabbit.erl
index f09556a423..dbd31a5910 100644
--- a/src/rabbit.erl
+++ b/src/rabbit.erl
@@ -467,14 +467,14 @@ ensure_working_log_handlers() ->
log_location(kernel),
Handlers),
- ok = ensure_working_log_handler(sasl_report_file_h,
+ ok = ensure_working_log_handler(sasl_report_tty_h,
rabbit_sasl_report_file_h,
sasl_report_tty_h,
log_location(sasl),
Handlers),
ok.
-ensure_working_log_handler(OldFHandler, NewFHandler, TTYHandler,
+ensure_working_log_handler(OldHandler, NewHandler, TTYHandler,
LogLocation, Handlers) ->
case LogLocation of
undefined -> ok;
@@ -484,10 +484,10 @@ ensure_working_log_handler(OldFHandler, NewFHandler, TTYHandler,
throw({error, {cannot_log_to_tty,
TTYHandler, not_installed}})
end;
- _ -> case lists:member(NewFHandler, Handlers) of
+ _ -> case lists:member(NewHandler, Handlers) of
true -> ok;
false -> case rotate_logs(LogLocation, "",
- OldFHandler, NewFHandler) of
+ OldHandler, NewHandler) of
ok -> ok;
{error, Reason} ->
throw({error, {cannot_log_to_file,
diff --git a/src/rabbit_error_logger_file_h.erl b/src/rabbit_error_logger_file_h.erl
index 8667d94cac..f481c21e51 100644
--- a/src/rabbit_error_logger_file_h.erl
+++ b/src/rabbit_error_logger_file_h.erl
@@ -26,6 +26,10 @@
%% with the result of closing the old handler when swapping handlers.
%% The first init/1 additionally allows for simple log rotation
%% when the suffix is not the empty string.
+%% The original init/2 also opened the file in 'write' mode, thus
+%% overwriting old logs. To remedy this, init/2 from
+%% lib/stdlib/src/error_logger_file_h.erl from R14B3 was copied as
+%% init_file/2 and changed so that it opens the file in 'append' mode.
%% Used only when swapping handlers in log rotation
init({{File, Suffix}, []}) ->
diff --git a/src/rabbit_sasl_report_file_h.erl b/src/rabbit_sasl_report_file_h.erl
index 99e3b141e7..cdd3287f75 100644
--- a/src/rabbit_sasl_report_file_h.erl
+++ b/src/rabbit_sasl_report_file_h.erl
@@ -26,6 +26,10 @@
%% with the result of closing the old handler when swapping handlers.
%% The first init/1 additionally allows for simple log rotation
%% when the suffix is not the empty string.
+%% The original init/1 also opened the file in 'write' mode, thus
+%% overwriting old logs. To remedy this, init/1 from
+%% lib/sasl/src/sasl_report_file_h.erl from R14B3 was copied as
+%% init_file/1 and changed so that it opens the file in 'append' mode.
%% Used only when swapping handlers and performing
%% log rotation
diff --git a/src/rabbit_tests.erl b/src/rabbit_tests.erl
index d39072b463..3b129fbe9f 100644
--- a/src/rabbit_tests.erl
+++ b/src/rabbit_tests.erl
@@ -821,7 +821,7 @@ test_log_management() ->
ok = make_files_non_writable([MainLog, SaslLog]),
ok = control_action(rotate_logs, []),
- %% logging directed to tty (handlers were removed in last test)
+ %% logging directed to tty (first, remove handlers)
ok = delete_log_handlers([rabbit_sasl_report_file_h,
rabbit_error_logger_file_h]),
ok = clean_logs([MainLog, SaslLog], Suffix),