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

New option support: log_rotate_count

This commit is contained in:
Evgeniy Khramtsov 2013-11-18 23:22:48 +10:00 committed by Christophe Romain
parent bb8a0f71e6
commit 273631c242
2 changed files with 15 additions and 2 deletions

View File

@ -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.

View File

@ -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};