25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-20 16:15:59 +01:00

Config reload should update loger settings part 2

This commit is contained in:
Paweł Chmielowski 2024-02-28 12:03:42 +01:00
parent 06675e4fb2
commit c69884fa3f
2 changed files with 8 additions and 3 deletions

View File

@ -111,6 +111,9 @@ reload() ->
ejabberd_hooks:run(host_down, [Host]) ejabberd_hooks:run(host_down, [Host])
end, DelHosts), end, DelHosts),
ejabberd_hooks:run(config_reloaded, []), ejabberd_hooks:run(config_reloaded, []),
% logger is started too early to be able to use hooks, so
% we need to call it separately
ejabberd_logger:config_reloaded(),
delete_host_options(DelHosts), delete_host_options(DelHosts),
?INFO_MSG("Configuration reloaded successfully", []); ?INFO_MSG("Configuration reloaded successfully", []);
Err -> Err ->

View File

@ -27,9 +27,9 @@
%% API %% API
-export([start/0, get/0, set/1, get_log_path/0, flush/0]). -export([start/0, get/0, set/1, get_log_path/0, flush/0]).
-export([convert_loglevel/1, loglevels/0, set_modules_fully_logged/1]). -export([convert_loglevel/1, loglevels/0, set_modules_fully_logged/1, config_reloaded/0]).
-ifndef(LAGER). -ifndef(LAGER).
-export([progress_filter/2, config_reloaded/0]). -export([progress_filter/2]).
-endif. -endif.
%% Deprecated functions %% Deprecated functions
-export([restart/0, reopen_log/0, rotate_log/0]). -export([restart/0, reopen_log/0, rotate_log/0]).
@ -185,6 +185,9 @@ restart() ->
application:stop(lager), application:stop(lager),
start(Level). start(Level).
config_reloaded() ->
ok.
reopen_log() -> reopen_log() ->
ok. ok.
@ -266,7 +269,6 @@ start(Level) ->
EjabberdLog = get_log_path(), EjabberdLog = get_log_path(),
Dir = filename:dirname(EjabberdLog), Dir = filename:dirname(EjabberdLog),
ErrorLog = filename:join([Dir, "error.log"]), ErrorLog = filename:join([Dir, "error.log"]),
ejabberd_hooks:add(config_reloaded, ?MODULE, config_reloaded, 50),
LogRotateSize = get_integer_env(log_rotate_size, 10*1024*1024), LogRotateSize = get_integer_env(log_rotate_size, 10*1024*1024),
LogRotateCount = get_integer_env(log_rotate_count, 1), LogRotateCount = get_integer_env(log_rotate_count, 1),
LogBurstLimitWindowTime = get_integer_env(log_burst_limit_window_time, 1000), LogBurstLimitWindowTime = get_integer_env(log_burst_limit_window_time, 1000),