diff options
-rw-r--r-- | doc/guide.tex | 9 | ||||
-rw-r--r-- | src/ejabberd_logger.erl | 8 |
2 files changed, 15 insertions, 2 deletions
diff --git a/doc/guide.tex b/doc/guide.tex index 7a469de3b..524007965 100644 --- a/doc/guide.tex +++ b/doc/guide.tex @@ -6069,6 +6069,15 @@ The ejabberdctl command \term{reopen-log} reopens the log files, and also renames the old ones if you didn't rename them. +The option \term{log\_rotate\_count} defines the number of rotated files to keep +by \term{reopen-log} command. +Every such file has a numeric suffix. The exact format is: +\begin{description} + \titem{log\_rotate\_count: N} The default value is 1, + which means only \term{ejabberd.log.0}, \term{error.log.0} + and \term{crash.log.0} will be kept. +\end{description} + \makesection{debugconsole}{Debug Console} The Debug Console is an Erlang shell attached to an already running \ejabberd{} server. diff --git a/src/ejabberd_logger.erl b/src/ejabberd_logger.erl index 7c47b8b72..f5ee863a8 100644 --- a/src/ejabberd_logger.erl +++ b/src/ejabberd_logger.erl @@ -83,20 +83,24 @@ start() -> ErrorLog = filename:join([Dir, "error.log"]), CrashLog = filename:join([Dir, "crash.log"]), LogRotateSize = get_pos_integer_env(log_rotate_size, 10*1024*1024), + LogRotateCount = get_pos_integer_env(log_rotate_count, 1), LogRateLimit = get_pos_integer_env(log_rate_limit, 100), application:set_env(lager, error_logger_hwm, LogRateLimit), application:set_env( lager, handlers, [{lager_console_backend, info}, {lager_file_backend, [{file, ConsoleLog}, {level, info}, - {count, 1}, {size, LogRotateSize}]}, + {count, LogRotateCount}, {size, LogRotateSize}]}, {lager_file_backend, [{file, ErrorLog}, {level, error}, - {count, 1}, {size, LogRotateSize}]}]), + {count, LogRotateCount}, {size, LogRotateSize}]}]), application:set_env(lager, crash_log, CrashLog), + application:set_env(lager, crash_log_size, LogRotateSize), + application:set_env(lager, crash_log_count, LogRotateCount), ejabberd:start_app(lager), ok. reopen_log() -> + lager_crash_log ! rotate, lists:foreach( fun({lager_file_backend, File}) -> whereis(lager_event) ! {rotate, File}; |