25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-28 16:34:13 +01:00

Do not rely on p1_logger_h module when lager is enabled

This commit is contained in:
Evgeniy Khramtsov 2013-08-27 17:43:50 +10:00
parent 0fe3de6b30
commit e3483ef9e1

View File

@ -155,13 +155,22 @@ reopen_sasl_log() ->
case application:get_env(sasl,sasl_error_logger) of
{ok, {file, SASLfile}} ->
error_logger:delete_report_handler(sasl_report_file_h),
p1_logger_h:rotate_log(SASLfile),
rotate_sasl_log(SASLfile),
error_logger:add_report_handler(sasl_report_file_h,
{SASLfile, get_sasl_error_logger_type()});
_ -> false
end,
ok.
rotate_sasl_log(Filename) ->
case file:read_file_info(Filename) of
{ok, _FileInfo} ->
file:rename(Filename, [Filename, ".0"]),
ok;
{error, _Reason} ->
ok
end.
%% Function copied from Erlang/OTP lib/sasl/src/sasl.erl which doesn't export it
get_sasl_error_logger_type () ->
case application:get_env (sasl, errlog_type) of