mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-22 16:20:52 +01:00
Change loglevel on configuration reload
This commit is contained in:
parent
d523357ba8
commit
7a9fa52e91
@ -161,11 +161,6 @@ delete_pid_file() ->
|
|||||||
end.
|
end.
|
||||||
|
|
||||||
set_settings_from_config() ->
|
set_settings_from_config() ->
|
||||||
Level = ejabberd_config:get_option(
|
|
||||||
loglevel,
|
|
||||||
fun(P) when P>=0, P=<5 -> P end,
|
|
||||||
4),
|
|
||||||
ejabberd_logger:set(Level),
|
|
||||||
Ticktime = ejabberd_config:get_option(
|
Ticktime = ejabberd_config:get_option(
|
||||||
net_ticktime,
|
net_ticktime,
|
||||||
opt_type(net_ticktime),
|
opt_type(net_ticktime),
|
||||||
@ -185,16 +180,7 @@ opt_type(net_ticktime) ->
|
|||||||
fun (P) when is_integer(P), P > 0 -> P end;
|
fun (P) when is_integer(P), P > 0 -> P end;
|
||||||
opt_type(cluster_nodes) ->
|
opt_type(cluster_nodes) ->
|
||||||
fun (Ns) -> true = lists:all(fun is_atom/1, Ns), Ns end;
|
fun (Ns) -> true = lists:all(fun is_atom/1, Ns), Ns end;
|
||||||
opt_type(loglevel) ->
|
opt_type(_) -> [cluster_nodes, net_ticktime].
|
||||||
fun (P) when P >= 0, P =< 5 -> P end;
|
|
||||||
opt_type(modules) ->
|
|
||||||
fun (Mods) ->
|
|
||||||
lists:map(fun ({M, A}) when is_atom(M), is_list(A) ->
|
|
||||||
{M, A}
|
|
||||||
end,
|
|
||||||
Mods)
|
|
||||||
end;
|
|
||||||
opt_type(_) -> [cluster_nodes, loglevel, modules, net_ticktime].
|
|
||||||
|
|
||||||
setup_if_elixir_conf_used() ->
|
setup_if_elixir_conf_used() ->
|
||||||
case ejabberd_config:is_using_elixir_config() of
|
case ejabberd_config:is_using_elixir_config() of
|
||||||
|
@ -354,7 +354,6 @@ get_absolute_path(File) ->
|
|||||||
filename:absname(File)
|
filename:absname(File)
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
|
||||||
search_hosts(Term, State) ->
|
search_hosts(Term, State) ->
|
||||||
case Term of
|
case Term of
|
||||||
{host, Host} ->
|
{host, Host} ->
|
||||||
@ -772,20 +771,28 @@ set_opts(State) ->
|
|||||||
lists:foreach(fun mnesia:write/1, Opts)
|
lists:foreach(fun mnesia:write/1, Opts)
|
||||||
end,
|
end,
|
||||||
case mnesia:transaction(F) of
|
case mnesia:transaction(F) of
|
||||||
{atomic, _} -> ok;
|
{atomic, _} ->
|
||||||
|
set_log_level();
|
||||||
{aborted,{no_exists,Table}} ->
|
{aborted,{no_exists,Table}} ->
|
||||||
MnesiaDirectory = mnesia:system_info(directory),
|
MnesiaDirectory = mnesia:system_info(directory),
|
||||||
?ERROR_MSG("Error reading Mnesia database spool files:~n"
|
?CRITICAL_MSG("Error reading Mnesia database spool files:~n"
|
||||||
"The Mnesia database couldn't read the spool file for the table '~p'.~n"
|
"The Mnesia database couldn't read the spool file for the table '~p'.~n"
|
||||||
"ejabberd needs read and write access in the directory:~n ~s~n"
|
"ejabberd needs read and write access in the directory:~n ~s~n"
|
||||||
"Maybe the problem is a change in the computer hostname,~n"
|
"Maybe the problem is a change in the computer hostname,~n"
|
||||||
"or a change in the Erlang node name, which is currently:~n ~p~n"
|
"or a change in the Erlang node name, which is currently:~n ~p~n"
|
||||||
"Check the ejabberd guide for details about changing the~n"
|
"Check the ejabberd guide for details about changing the~n"
|
||||||
"computer hostname or Erlang node name.~n",
|
"computer hostname or Erlang node name.~n",
|
||||||
[Table, MnesiaDirectory, node()]),
|
[Table, MnesiaDirectory, node()]),
|
||||||
exit("Error reading Mnesia database")
|
exit("Error reading Mnesia database")
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
set_log_level() ->
|
||||||
|
Level = ejabberd_config:get_option(
|
||||||
|
loglevel,
|
||||||
|
fun(P) when P>=0, P=<5 -> P end,
|
||||||
|
4),
|
||||||
|
ejabberd_logger:set(Level).
|
||||||
|
|
||||||
add_global_option(Opt, Val) ->
|
add_global_option(Opt, Val) ->
|
||||||
add_option(Opt, Val).
|
add_option(Opt, Val).
|
||||||
|
|
||||||
@ -1445,9 +1452,11 @@ opt_type(default_db) ->
|
|||||||
fun(T) when is_atom(T) -> T end;
|
fun(T) when is_atom(T) -> T end;
|
||||||
opt_type(default_ram_db) ->
|
opt_type(default_ram_db) ->
|
||||||
fun(T) when is_atom(T) -> T end;
|
fun(T) when is_atom(T) -> T end;
|
||||||
|
opt_type(loglevel) ->
|
||||||
|
fun (P) when P >= 0, P =< 5 -> P end;
|
||||||
opt_type(_) ->
|
opt_type(_) ->
|
||||||
[hide_sensitive_log_data, hosts, language,
|
[hide_sensitive_log_data, hosts, language,
|
||||||
default_db, default_ram_db].
|
default_db, default_ram_db, loglevel].
|
||||||
|
|
||||||
-spec may_hide_data(any()) -> any().
|
-spec may_hide_data(any()) -> any().
|
||||||
may_hide_data(Data) ->
|
may_hide_data(Data) ->
|
||||||
|
Loading…
Reference in New Issue
Block a user