mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-24 16:23:40 +01:00
Don't let "reopen_log" rotate files (EJAB-1243)
Make sure the "reopen_log" command really just reopens log files without also rotating them. For rotating log files, the new "rotate_log" command can be used.
This commit is contained in:
parent
325c17f277
commit
07baf2d973
@ -28,7 +28,7 @@
|
||||
|
||||
-export([start/0, stop/0,
|
||||
%% Server
|
||||
status/0, reopen_log/0,
|
||||
status/0, reopen_log/0, rotate_log/0,
|
||||
set_loglevel/1,
|
||||
stop_kindly/2, send_service_message_all_mucs/2,
|
||||
registered_vhosts/0,
|
||||
@ -88,6 +88,10 @@ commands() ->
|
||||
desc = "Reopen the log files",
|
||||
module = ?MODULE, function = reopen_log,
|
||||
args = [], result = {res, rescode}},
|
||||
#ejabberd_commands{name = rotate_log, tags = [logs, server],
|
||||
desc = "Rotate the log files",
|
||||
module = ?MODULE, function = rotate_log,
|
||||
args = [], result = {res, rescode}},
|
||||
#ejabberd_commands{name = stop_kindly, tags = [server],
|
||||
desc = "Inform users and rooms, wait, and stop the server",
|
||||
longdesc = "Provide the delay in seconds, and the "
|
||||
@ -276,6 +280,9 @@ reopen_log() ->
|
||||
ejabberd_hooks:run(reopen_log_hook, []),
|
||||
ejabberd_logger:reopen_log().
|
||||
|
||||
rotate_log() ->
|
||||
ejabberd_hooks:run(rotate_log_hook, []),
|
||||
ejabberd_logger:rotate_log().
|
||||
|
||||
set_loglevel(LogLevel) ->
|
||||
{module, Module} = ejabberd_logger:set(LogLevel),
|
||||
|
@ -27,7 +27,7 @@
|
||||
-behaviour(ejabberd_config).
|
||||
|
||||
%% API
|
||||
-export([start/0, reopen_log/0, get/0, set/1, get_log_path/0, opt_type/1]).
|
||||
-export([start/0, reopen_log/0, rotate_log/0, get/0, set/1, get_log_path/0, opt_type/1]).
|
||||
|
||||
-include("ejabberd.hrl").
|
||||
|
||||
@ -36,6 +36,7 @@
|
||||
-spec start() -> ok.
|
||||
-spec get_log_path() -> string().
|
||||
-spec reopen_log() -> ok.
|
||||
-spec rotate_log() -> ok.
|
||||
-spec get() -> {loglevel(), atom(), string()}.
|
||||
-spec set(loglevel() | {loglevel(), list()}) -> {module, module()}.
|
||||
|
||||
@ -128,6 +129,10 @@ start() ->
|
||||
ok.
|
||||
|
||||
reopen_log() ->
|
||||
%% Lager detects external log rotation automatically.
|
||||
ok.
|
||||
|
||||
rotate_log() ->
|
||||
lager_crash_log ! rotate,
|
||||
lists:foreach(
|
||||
fun({lager_file_backend, File}) ->
|
||||
@ -191,6 +196,10 @@ reopen_log() ->
|
||||
p1_logger_h:reopen_log(),
|
||||
reopen_sasl_log().
|
||||
|
||||
rotate_log() ->
|
||||
%% Not implemented.
|
||||
ok.
|
||||
|
||||
get() ->
|
||||
p1_loglevel:get().
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user