25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-24 16:23:40 +01:00

Switch more log message to warning level

The commit is supposed to improve logging at loglevel 3, which
is the recommended level for high loaded ejabberd servers
This commit is contained in:
Evgeny Khramtsov 2018-09-19 23:12:14 +03:00
parent ddca2e8b4a
commit 08f3d066b1
14 changed files with 58 additions and 59 deletions

View File

@ -312,7 +312,7 @@ normalize_spec(Spec) ->
{ok, Net, Mask} -> {ok, Net, Mask} ->
{ip, {Net, Mask}}; {ip, {Net, Mask}};
error -> error ->
?INFO_MSG("Invalid network address: ~p", [S]), ?WARNING_MSG("Invalid network address: ~p", [S]),
none none
end; end;
BadVal -> BadVal ->

View File

@ -408,7 +408,7 @@ bind(R, #{user := U, server := S, access := Access, lang := Lang,
{ok, State2}; {ok, State2};
deny -> deny ->
ejabberd_hooks:run(forbidden_session_hook, LServer, [JID]), ejabberd_hooks:run(forbidden_session_hook, LServer, [JID]),
?INFO_MSG("(~s) Forbidden c2s session for ~s", ?WARNING_MSG("(~s) Forbidden c2s session for ~s",
[xmpp_socket:pp(Socket), jid:encode(JID)]), [xmpp_socket:pp(Socket), jid:encode(JID)]),
Txt = <<"Access denied by service policy">>, Txt = <<"Access denied by service policy">>,
{error, xmpp:err_not_allowed(Txt, Lang), State} {error, xmpp:err_not_allowed(Txt, Lang), State}
@ -444,7 +444,7 @@ handle_auth_success(User, Mech, AuthModule,
handle_auth_failure(User, Mech, Reason, handle_auth_failure(User, Mech, Reason,
#{socket := Socket, #{socket := Socket,
ip := IP, lserver := LServer} = State) -> ip := IP, lserver := LServer} = State) ->
?INFO_MSG("(~s) Failed c2s ~s authentication ~sfrom ~s: ~s", ?WARNING_MSG("(~s) Failed c2s ~s authentication ~sfrom ~s: ~s",
[xmpp_socket:pp(Socket), Mech, [xmpp_socket:pp(Socket), Mech,
if User /= <<"">> -> ["for ", User, "@", LServer, " "]; if User /= <<"">> -> ["for ", User, "@", LServer, " "];
true -> "" true -> ""

View File

@ -201,7 +201,7 @@ send_file(State, Fd, Size, FileName) ->
end end
catch _:{case_clause, {error, Why}} -> catch _:{case_clause, {error, Why}} ->
if Why /= closed -> if Why /= closed ->
?INFO_MSG("Failed to read ~s: ~s", ?WARNING_MSG("Failed to read ~s: ~s",
[FileName, file_format_error(Why)]), [FileName, file_format_error(Why)]),
exit(normal); exit(normal);
true -> true ->

View File

@ -195,7 +195,7 @@ handle_auth_failure(RServer, Mech, Reason,
#{socket := Socket, ip := IP, #{socket := Socket, ip := IP,
server_host := ServerHost, server_host := ServerHost,
lserver := LServer} = State) -> lserver := LServer} = State) ->
?INFO_MSG("(~s) Failed inbound s2s ~s authentication ~s -> ~s (~s): ~s", ?WARNING_MSG("(~s) Failed inbound s2s ~s authentication ~s -> ~s (~s): ~s",
[xmpp_socket:pp(Socket), Mech, RServer, LServer, [xmpp_socket:pp(Socket), Mech, RServer, LServer,
ejabberd_config:may_hide_data(misc:ip_to_list(IP)), Reason]), ejabberd_config:may_hide_data(misc:ip_to_list(IP)), Reason]),
ejabberd_hooks:run_fold(s2s_in_auth_result, ejabberd_hooks:run_fold(s2s_in_auth_result,

View File

@ -138,7 +138,7 @@ host_down(Host) ->
process_auth_result(#{server := LServer, remote_server := RServer} = State, process_auth_result(#{server := LServer, remote_server := RServer} = State,
{false, Reason}) -> {false, Reason}) ->
Delay = get_delay(), Delay = get_delay(),
?INFO_MSG("Failed to establish outbound s2s connection ~s -> ~s: " ?WARNING_MSG("Failed to establish outbound s2s connection ~s -> ~s: "
"authentication failed; bouncing for ~p seconds", "authentication failed; bouncing for ~p seconds",
[LServer, RServer, Delay]), [LServer, RServer, Delay]),
State1 = State#{on_route => bounce, stop_reason => Reason}, State1 = State#{on_route => bounce, stop_reason => Reason},
@ -157,7 +157,7 @@ process_closed(#{server := LServer, remote_server := RServer,
process_closed(#{server := LServer, remote_server := RServer} = State, process_closed(#{server := LServer, remote_server := RServer} = State,
Reason) -> Reason) ->
Delay = get_delay(), Delay = get_delay(),
?INFO_MSG("Failed to establish outbound s2s connection ~s -> ~s: ~s; " ?WARNING_MSG("Failed to establish outbound s2s connection ~s -> ~s: ~s; "
"bouncing for ~p seconds", "bouncing for ~p seconds",
[LServer, RServer, format_error(Reason), Delay]), [LServer, RServer, format_error(Reason), Delay]),
State1 = State#{on_route => bounce}, State1 = State#{on_route => bounce},
@ -223,7 +223,7 @@ handle_auth_failure(Mech, Reason,
remote_server := RServer, remote_server := RServer,
server_host := ServerHost, server_host := ServerHost,
server := LServer} = State) -> server := LServer} = State) ->
?INFO_MSG("(~s) Failed outbound s2s ~s authentication ~s -> ~s (~s): ~s", ?WARNING_MSG("(~s) Failed outbound s2s ~s authentication ~s -> ~s (~s): ~s",
[xmpp_socket:pp(Socket), Mech, LServer, RServer, [xmpp_socket:pp(Socket), Mech, LServer, RServer,
ejabberd_config:may_hide_data(misc:ip_to_list(IP)), ejabberd_config:may_hide_data(misc:ip_to_list(IP)),
xmpp_stream_out:format_error(Reason)]), xmpp_stream_out:format_error(Reason)]),

View File

@ -146,7 +146,7 @@ get_password_fun(#{remote_server := RemoteServer,
{ok, Password} -> {ok, Password} ->
{Password, undefined}; {Password, undefined};
error -> error ->
?INFO_MSG("(~s) Domain ~s is unconfigured for " ?WARNING_MSG("(~s) Domain ~s is unconfigured for "
"external component from ~s", "external component from ~s",
[xmpp_socket:pp(Socket), RemoteServer, [xmpp_socket:pp(Socket), RemoteServer,
ejabberd_config:may_hide_data(misc:ip_to_list(IP))]), ejabberd_config:may_hide_data(misc:ip_to_list(IP))]),
@ -177,7 +177,7 @@ handle_auth_success(_, Mech, _,
handle_auth_failure(_, Mech, Reason, handle_auth_failure(_, Mech, Reason,
#{remote_server := RemoteServer, #{remote_server := RemoteServer,
socket := Socket, ip := IP} = State) -> socket := Socket, ip := IP} = State) ->
?INFO_MSG("(~s) Failed external component ~s authentication " ?WARNING_MSG("(~s) Failed external component ~s authentication "
"for ~s from ~s: ~s", "for ~s from ~s: ~s",
[xmpp_socket:pp(Socket), Mech, RemoteServer, [xmpp_socket:pp(Socket), Mech, RemoteServer,
ejabberd_config:may_hide_data(misc:ip_to_list(IP)), ejabberd_config:may_hide_data(misc:ip_to_list(IP)),

View File

@ -335,7 +335,7 @@ connecting(connect, #state{host = Host} = State) ->
State2 = get_db_version(State1), State2 = get_db_version(State1),
{next_state, session_established, State2}; {next_state, session_established, State2};
{error, Reason} -> {error, Reason} ->
?INFO_MSG("~p connection failed:~n** Reason: ~p~n** " ?WARNING_MSG("~p connection failed:~n** Reason: ~p~n** "
"Retry after: ~p seconds", "Retry after: ~p seconds",
[State#state.db_type, Reason, [State#state.db_type, Reason,
State#state.start_interval div 1000]), State#state.start_interval div 1000]),
@ -621,7 +621,6 @@ sql_query_internal(Query) ->
[Query], self(), [Query], self(),
[{timeout, QueryTimeout - 1000}, [{timeout, QueryTimeout - 1000},
{result_type, binary}])), {result_type, binary}])),
%% ?INFO_MSG("MySQL, Received result~n~p~n", [R]),
R; R;
sqlite -> sqlite ->
Host = State#state.host, Host = State#state.host,

View File

@ -190,7 +190,7 @@ check_sqlite_db(Host) ->
ok ok
end; end;
{error, Reason} -> {error, Reason} ->
?INFO_MSG("Failed open sqlite database, reason ~p", [Reason]) ?WARNING_MSG("Failed open sqlite database, reason ~p", [Reason])
end. end.
create_sqlite_tables(DB) -> create_sqlite_tables(DB) ->
@ -203,7 +203,7 @@ create_sqlite_tables(DB) ->
[ok = sqlite3:sql_exec(DB, Q) || Q <- Qs], [ok = sqlite3:sql_exec(DB, Q) || Q <- Qs],
ok = sqlite3:sql_exec(DB, "commit"); ok = sqlite3:sql_exec(DB, "commit");
{error, Reason} -> {error, Reason} ->
?INFO_MSG("Failed to read SQLite schema file: ~s", ?WARNING_MSG("Failed to read SQLite schema file: ~s",
[file:format_error(Reason)]) [file:format_error(Reason)])
end. end.

View File

@ -166,7 +166,7 @@ process([<<"doc">>, LocalFile], _Request) ->
"documentation with the environment variable " "documentation with the environment variable "
"EJABBERD_DOC_PATH. Check the ejabberd " "EJABBERD_DOC_PATH. Check the ejabberd "
"Guide for more information.">>, "Guide for more information.">>,
?INFO_MSG("Problem '~p' accessing the local Guide file ~s", [Error, Help]), ?WARNING_MSG("Problem '~p' accessing the local Guide file ~s", [Error, Help]),
case Error of case Error of
eacces -> {403, [], <<"Forbidden", Help/binary>>}; eacces -> {403, [], <<"Forbidden", Help/binary>>};
enoent -> {307, [{<<"Location">>, <<"http://docs.ejabberd.im/admin/guide/configuration/">>}], <<"Not found", Help/binary>>}; enoent -> {307, [{<<"Location">>, <<"http://docs.ejabberd.im/admin/guide/configuration/">>}], <<"Not found", Help/binary>>};
@ -1873,7 +1873,7 @@ get_node(Host, Node, [<<"modules">>], Query, Lang)
Modules, Query) Modules, Query)
of of
submitted -> ok; submitted -> ok;
{'EXIT', Reason} -> ?INFO_MSG("~p~n", [Reason]), error; {'EXIT', Reason} -> ?ERROR_MSG("~p~n", [Reason]), error;
_ -> nothing _ -> nothing
end, end,
NewModules = lists:sort(ejabberd_cluster:call(Node, gen_mod, NewModules = lists:sort(ejabberd_cluster:call(Node, gen_mod,

View File

@ -57,7 +57,7 @@ start_link(Name, Hosts, Backups, Port, Rootdn, Passwd,
of of
{ok, Pid} -> pg2:join(PoolName, Pid); {ok, Pid} -> pg2:join(PoolName, Pid);
Err -> Err ->
?INFO_MSG("Err = ~p", [Err]), ?ERROR_MSG("Err = ~p", [Err]),
error error
end end
end, end,

View File

@ -407,11 +407,11 @@ process(_LocalPath, #request{method = 'PUT', host = Host, ip = IP,
http_response(500) http_response(500)
end; end;
{error, size_mismatch} -> {error, size_mismatch} ->
?INFO_MSG("Rejecting file ~s from ~s for ~s: Unexpected size (~B)", ?WARNING_MSG("Rejecting file ~s from ~s for ~s: Unexpected size (~B)",
[lists:last(Slot), encode_addr(IP), Host, Length]), [lists:last(Slot), encode_addr(IP), Host, Length]),
http_response(413); http_response(413);
{error, invalid_slot} -> {error, invalid_slot} ->
?INFO_MSG("Rejecting file ~s from ~s for ~s: Invalid slot", ?WARNING_MSG("Rejecting file ~s from ~s for ~s: Invalid slot",
[lists:last(Slot), encode_addr(IP), Host]), [lists:last(Slot), encode_addr(IP), Host]),
http_response(403); http_response(403);
Error -> Error ->
@ -443,19 +443,19 @@ process(_LocalPath, #request{method = Method, host = Host, ip = IP} = Request)
Headers3 = Headers2 ++ CustomHeaders, Headers3 = Headers2 ++ CustomHeaders,
http_response(200, Headers3, {file, Path}); http_response(200, Headers3, {file, Path});
{error, eacces} -> {error, eacces} ->
?INFO_MSG("Cannot serve ~s to ~s: Permission denied", ?WARNING_MSG("Cannot serve ~s to ~s: Permission denied",
[Path, encode_addr(IP)]), [Path, encode_addr(IP)]),
http_response(403); http_response(403);
{error, enoent} -> {error, enoent} ->
?INFO_MSG("Cannot serve ~s to ~s: No such file", ?WARNING_MSG("Cannot serve ~s to ~s: No such file",
[Path, encode_addr(IP)]), [Path, encode_addr(IP)]),
http_response(404); http_response(404);
{error, eisdir} -> {error, eisdir} ->
?INFO_MSG("Cannot serve ~s to ~s: Is a directory", ?WARNING_MSG("Cannot serve ~s to ~s: Is a directory",
[Path, encode_addr(IP)]), [Path, encode_addr(IP)]),
http_response(404); http_response(404);
{error, Error} -> {error, Error} ->
?INFO_MSG("Cannot serve ~s to ~s: ~s", ?WARNING_MSG("Cannot serve ~s to ~s: ~s",
[Path, encode_addr(IP), format_error(Error)]), [Path, encode_addr(IP), format_error(Error)]),
http_response(500) http_response(500)
end; end;
@ -572,7 +572,7 @@ create_slot(#state{service_url = undefined, max_size = MaxSize},
when MaxSize /= infinity, when MaxSize /= infinity,
Size > MaxSize -> Size > MaxSize ->
Text = {<<"File larger than ~w bytes">>, [MaxSize]}, Text = {<<"File larger than ~w bytes">>, [MaxSize]},
?INFO_MSG("Rejecting file ~s from ~s (too large: ~B bytes)", ?WARNING_MSG("Rejecting file ~s from ~s (too large: ~B bytes)",
[File, jid:encode(JID), Size]), [File, jid:encode(JID), Size]),
Error = xmpp:err_not_acceptable(Text, Lang), Error = xmpp:err_not_acceptable(Text, Lang),
Els = xmpp:get_els(Error), Els = xmpp:get_els(Error),
@ -629,15 +629,15 @@ create_slot(#state{service_url = ServiceURL},
{error, xmpp:err_service_unavailable(Txt, Lang)} {error, xmpp:err_service_unavailable(Txt, Lang)}
end; end;
{ok, {402, _Body}} -> {ok, {402, _Body}} ->
?INFO_MSG("Got status code 402 for ~s from <~s>", ?WARNING_MSG("Got status code 402 for ~s from <~s>",
[jid:encode(JID), ServiceURL]), [jid:encode(JID), ServiceURL]),
{error, xmpp:err_resource_constraint()}; {error, xmpp:err_resource_constraint()};
{ok, {403, _Body}} -> {ok, {403, _Body}} ->
?INFO_MSG("Got status code 403 for ~s from <~s>", ?WARNING_MSG("Got status code 403 for ~s from <~s>",
[jid:encode(JID), ServiceURL]), [jid:encode(JID), ServiceURL]),
{error, xmpp:err_not_allowed()}; {error, xmpp:err_not_allowed()};
{ok, {413, _Body}} -> {ok, {413, _Body}} ->
?INFO_MSG("Got status code 413 for ~s from <~s>", ?WARNING_MSG("Got status code 413 for ~s from <~s>",
[jid:encode(JID), ServiceURL]), [jid:encode(JID), ServiceURL]),
{error, xmpp:err_not_acceptable()}; {error, xmpp:err_not_acceptable()};
{ok, {Code, _Body}} -> {ok, {Code, _Body}} ->

View File

@ -151,7 +151,7 @@ request(Req, SIPSock, TrID, Action) ->
mod_sip_proxy:route(Req, SIPSock, TrID, Pid), mod_sip_proxy:route(Req, SIPSock, TrID, Pid),
{mod_sip_proxy, route, [Pid]}; {mod_sip_proxy, route, [Pid]};
Err -> Err ->
?INFO_MSG("failed to proxy request ~p: ~p", [Req, Err]), ?WARNING_MSG("Failed to proxy request ~p: ~p", [Req, Err]),
Err Err
end; end;
{proxy_auth, LServer} -> {proxy_auth, LServer} ->

View File

@ -446,7 +446,7 @@ handle_resume(#{user := User, lserver := LServer,
[xmpp_socket:pp(Socket), jid:encode(JID)]), [xmpp_socket:pp(Socket), jid:encode(JID)]),
{ok, State5}; {ok, State5};
{error, El, Msg} -> {error, El, Msg} ->
?INFO_MSG("Cannot resume session for ~s@~s: ~s", ?WARNING_MSG("Cannot resume session for ~s@~s: ~s",
[User, LServer, Msg]), [User, LServer, Msg]),
{error, send(State, El)} {error, send(State, El)}
end. end.

View File

@ -60,7 +60,7 @@ from_dir(ProsodyDir) ->
Err Err
end; end;
{error, _} = Err -> {error, _} = Err ->
?INFO_MSG("The file 'luerl.beam' is not found: maybe " ?ERROR_MSG("The file 'luerl.beam' is not found: maybe "
"ejabberd is not compiled with Lua support", []), "ejabberd is not compiled with Lua support", []),
Err Err
end. end.