mirror of
https://github.com/processone/ejabberd.git
synced 2024-10-09 15:06:54 +02: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:
parent
ddca2e8b4a
commit
08f3d066b1
@ -312,7 +312,7 @@ normalize_spec(Spec) ->
|
||||
{ok, Net, Mask} ->
|
||||
{ip, {Net, Mask}};
|
||||
error ->
|
||||
?INFO_MSG("Invalid network address: ~p", [S]),
|
||||
?WARNING_MSG("Invalid network address: ~p", [S]),
|
||||
none
|
||||
end;
|
||||
BadVal ->
|
||||
|
@ -408,8 +408,8 @@ bind(R, #{user := U, server := S, access := Access, lang := Lang,
|
||||
{ok, State2};
|
||||
deny ->
|
||||
ejabberd_hooks:run(forbidden_session_hook, LServer, [JID]),
|
||||
?INFO_MSG("(~s) Forbidden c2s session for ~s",
|
||||
[xmpp_socket:pp(Socket), jid:encode(JID)]),
|
||||
?WARNING_MSG("(~s) Forbidden c2s session for ~s",
|
||||
[xmpp_socket:pp(Socket), jid:encode(JID)]),
|
||||
Txt = <<"Access denied by service policy">>,
|
||||
{error, xmpp:err_not_allowed(Txt, Lang), State}
|
||||
end
|
||||
@ -444,12 +444,12 @@ handle_auth_success(User, Mech, AuthModule,
|
||||
handle_auth_failure(User, Mech, Reason,
|
||||
#{socket := Socket,
|
||||
ip := IP, lserver := LServer} = State) ->
|
||||
?INFO_MSG("(~s) Failed c2s ~s authentication ~sfrom ~s: ~s",
|
||||
[xmpp_socket:pp(Socket), Mech,
|
||||
if User /= <<"">> -> ["for ", User, "@", LServer, " "];
|
||||
true -> ""
|
||||
end,
|
||||
ejabberd_config:may_hide_data(misc:ip_to_list(IP)), Reason]),
|
||||
?WARNING_MSG("(~s) Failed c2s ~s authentication ~sfrom ~s: ~s",
|
||||
[xmpp_socket:pp(Socket), Mech,
|
||||
if User /= <<"">> -> ["for ", User, "@", LServer, " "];
|
||||
true -> ""
|
||||
end,
|
||||
ejabberd_config:may_hide_data(misc:ip_to_list(IP)), Reason]),
|
||||
ejabberd_hooks:run_fold(c2s_auth_result, LServer, State, [false, User]).
|
||||
|
||||
handle_unbinded_packet(Pkt, #{lserver := LServer} = State) ->
|
||||
|
@ -201,8 +201,8 @@ send_file(State, Fd, Size, FileName) ->
|
||||
end
|
||||
catch _:{case_clause, {error, Why}} ->
|
||||
if Why /= closed ->
|
||||
?INFO_MSG("Failed to read ~s: ~s",
|
||||
[FileName, file_format_error(Why)]),
|
||||
?WARNING_MSG("Failed to read ~s: ~s",
|
||||
[FileName, file_format_error(Why)]),
|
||||
exit(normal);
|
||||
true ->
|
||||
ok
|
||||
|
@ -195,9 +195,9 @@ handle_auth_failure(RServer, Mech, Reason,
|
||||
#{socket := Socket, ip := IP,
|
||||
server_host := ServerHost,
|
||||
lserver := LServer} = State) ->
|
||||
?INFO_MSG("(~s) Failed inbound s2s ~s authentication ~s -> ~s (~s): ~s",
|
||||
[xmpp_socket:pp(Socket), Mech, RServer, LServer,
|
||||
ejabberd_config:may_hide_data(misc:ip_to_list(IP)), Reason]),
|
||||
?WARNING_MSG("(~s) Failed inbound s2s ~s authentication ~s -> ~s (~s): ~s",
|
||||
[xmpp_socket:pp(Socket), Mech, RServer, LServer,
|
||||
ejabberd_config:may_hide_data(misc:ip_to_list(IP)), Reason]),
|
||||
ejabberd_hooks:run_fold(s2s_in_auth_result,
|
||||
ServerHost, State, [false, RServer]).
|
||||
|
||||
|
@ -138,9 +138,9 @@ host_down(Host) ->
|
||||
process_auth_result(#{server := LServer, remote_server := RServer} = State,
|
||||
{false, Reason}) ->
|
||||
Delay = get_delay(),
|
||||
?INFO_MSG("Failed to establish outbound s2s connection ~s -> ~s: "
|
||||
"authentication failed; bouncing for ~p seconds",
|
||||
[LServer, RServer, Delay]),
|
||||
?WARNING_MSG("Failed to establish outbound s2s connection ~s -> ~s: "
|
||||
"authentication failed; bouncing for ~p seconds",
|
||||
[LServer, RServer, Delay]),
|
||||
State1 = State#{on_route => bounce, stop_reason => Reason},
|
||||
State2 = close(State1),
|
||||
State3 = bounce_queue(State2),
|
||||
@ -157,9 +157,9 @@ process_closed(#{server := LServer, remote_server := RServer,
|
||||
process_closed(#{server := LServer, remote_server := RServer} = State,
|
||||
Reason) ->
|
||||
Delay = get_delay(),
|
||||
?INFO_MSG("Failed to establish outbound s2s connection ~s -> ~s: ~s; "
|
||||
"bouncing for ~p seconds",
|
||||
[LServer, RServer, format_error(Reason), Delay]),
|
||||
?WARNING_MSG("Failed to establish outbound s2s connection ~s -> ~s: ~s; "
|
||||
"bouncing for ~p seconds",
|
||||
[LServer, RServer, format_error(Reason), Delay]),
|
||||
State1 = State#{on_route => bounce},
|
||||
State2 = bounce_queue(State1),
|
||||
xmpp_stream_out:set_timeout(State2, timer:seconds(Delay)).
|
||||
@ -223,10 +223,10 @@ handle_auth_failure(Mech, Reason,
|
||||
remote_server := RServer,
|
||||
server_host := ServerHost,
|
||||
server := LServer} = State) ->
|
||||
?INFO_MSG("(~s) Failed outbound s2s ~s authentication ~s -> ~s (~s): ~s",
|
||||
[xmpp_socket:pp(Socket), Mech, LServer, RServer,
|
||||
ejabberd_config:may_hide_data(misc:ip_to_list(IP)),
|
||||
xmpp_stream_out:format_error(Reason)]),
|
||||
?WARNING_MSG("(~s) Failed outbound s2s ~s authentication ~s -> ~s (~s): ~s",
|
||||
[xmpp_socket:pp(Socket), Mech, LServer, RServer,
|
||||
ejabberd_config:may_hide_data(misc:ip_to_list(IP)),
|
||||
xmpp_stream_out:format_error(Reason)]),
|
||||
ejabberd_hooks:run_fold(s2s_out_auth_result, ServerHost, State, [{false, Reason}]).
|
||||
|
||||
handle_packet(Pkt, #{server_host := ServerHost} = State) ->
|
||||
|
@ -146,10 +146,10 @@ get_password_fun(#{remote_server := RemoteServer,
|
||||
{ok, Password} ->
|
||||
{Password, undefined};
|
||||
error ->
|
||||
?INFO_MSG("(~s) Domain ~s is unconfigured for "
|
||||
"external component from ~s",
|
||||
[xmpp_socket:pp(Socket), RemoteServer,
|
||||
ejabberd_config:may_hide_data(misc:ip_to_list(IP))]),
|
||||
?WARNING_MSG("(~s) Domain ~s is unconfigured for "
|
||||
"external component from ~s",
|
||||
[xmpp_socket:pp(Socket), RemoteServer,
|
||||
ejabberd_config:may_hide_data(misc:ip_to_list(IP))]),
|
||||
{false, undefined}
|
||||
end
|
||||
end.
|
||||
@ -177,11 +177,11 @@ handle_auth_success(_, Mech, _,
|
||||
handle_auth_failure(_, Mech, Reason,
|
||||
#{remote_server := RemoteServer,
|
||||
socket := Socket, ip := IP} = State) ->
|
||||
?INFO_MSG("(~s) Failed external component ~s authentication "
|
||||
"for ~s from ~s: ~s",
|
||||
[xmpp_socket:pp(Socket), Mech, RemoteServer,
|
||||
ejabberd_config:may_hide_data(misc:ip_to_list(IP)),
|
||||
Reason]),
|
||||
?WARNING_MSG("(~s) Failed external component ~s authentication "
|
||||
"for ~s from ~s: ~s",
|
||||
[xmpp_socket:pp(Socket), Mech, RemoteServer,
|
||||
ejabberd_config:may_hide_data(misc:ip_to_list(IP)),
|
||||
Reason]),
|
||||
State.
|
||||
|
||||
handle_authenticated_packet(Pkt0, #{ip := {IP, _}, lang := Lang} = State)
|
||||
|
@ -335,10 +335,10 @@ connecting(connect, #state{host = Host} = State) ->
|
||||
State2 = get_db_version(State1),
|
||||
{next_state, session_established, State2};
|
||||
{error, Reason} ->
|
||||
?INFO_MSG("~p connection failed:~n** Reason: ~p~n** "
|
||||
"Retry after: ~p seconds",
|
||||
[State#state.db_type, Reason,
|
||||
State#state.start_interval div 1000]),
|
||||
?WARNING_MSG("~p connection failed:~n** Reason: ~p~n** "
|
||||
"Retry after: ~p seconds",
|
||||
[State#state.db_type, Reason,
|
||||
State#state.start_interval div 1000]),
|
||||
p1_fsm:send_event_after(State#state.start_interval,
|
||||
connect),
|
||||
{next_state, connecting, State}
|
||||
@ -621,7 +621,6 @@ sql_query_internal(Query) ->
|
||||
[Query], self(),
|
||||
[{timeout, QueryTimeout - 1000},
|
||||
{result_type, binary}])),
|
||||
%% ?INFO_MSG("MySQL, Received result~n~p~n", [R]),
|
||||
R;
|
||||
sqlite ->
|
||||
Host = State#state.host,
|
||||
|
@ -190,7 +190,7 @@ check_sqlite_db(Host) ->
|
||||
ok
|
||||
end;
|
||||
{error, Reason} ->
|
||||
?INFO_MSG("Failed open sqlite database, reason ~p", [Reason])
|
||||
?WARNING_MSG("Failed open sqlite database, reason ~p", [Reason])
|
||||
end.
|
||||
|
||||
create_sqlite_tables(DB) ->
|
||||
@ -203,8 +203,8 @@ create_sqlite_tables(DB) ->
|
||||
[ok = sqlite3:sql_exec(DB, Q) || Q <- Qs],
|
||||
ok = sqlite3:sql_exec(DB, "commit");
|
||||
{error, Reason} ->
|
||||
?INFO_MSG("Failed to read SQLite schema file: ~s",
|
||||
[file:format_error(Reason)])
|
||||
?WARNING_MSG("Failed to read SQLite schema file: ~s",
|
||||
[file:format_error(Reason)])
|
||||
end.
|
||||
|
||||
read_lines(Fd, File, Acc) ->
|
||||
|
@ -166,7 +166,7 @@ process([<<"doc">>, LocalFile], _Request) ->
|
||||
"documentation with the environment variable "
|
||||
"EJABBERD_DOC_PATH. Check the ejabberd "
|
||||
"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
|
||||
eacces -> {403, [], <<"Forbidden", 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)
|
||||
of
|
||||
submitted -> ok;
|
||||
{'EXIT', Reason} -> ?INFO_MSG("~p~n", [Reason]), error;
|
||||
{'EXIT', Reason} -> ?ERROR_MSG("~p~n", [Reason]), error;
|
||||
_ -> nothing
|
||||
end,
|
||||
NewModules = lists:sort(ejabberd_cluster:call(Node, gen_mod,
|
||||
|
@ -57,7 +57,7 @@ start_link(Name, Hosts, Backups, Port, Rootdn, Passwd,
|
||||
of
|
||||
{ok, Pid} -> pg2:join(PoolName, Pid);
|
||||
Err ->
|
||||
?INFO_MSG("Err = ~p", [Err]),
|
||||
?ERROR_MSG("Err = ~p", [Err]),
|
||||
error
|
||||
end
|
||||
end,
|
||||
|
@ -407,11 +407,11 @@ process(_LocalPath, #request{method = 'PUT', host = Host, ip = IP,
|
||||
http_response(500)
|
||||
end;
|
||||
{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]),
|
||||
http_response(413);
|
||||
{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]),
|
||||
http_response(403);
|
||||
Error ->
|
||||
@ -443,19 +443,19 @@ process(_LocalPath, #request{method = Method, host = Host, ip = IP} = Request)
|
||||
Headers3 = Headers2 ++ CustomHeaders,
|
||||
http_response(200, Headers3, {file, Path});
|
||||
{error, eacces} ->
|
||||
?INFO_MSG("Cannot serve ~s to ~s: Permission denied",
|
||||
?WARNING_MSG("Cannot serve ~s to ~s: Permission denied",
|
||||
[Path, encode_addr(IP)]),
|
||||
http_response(403);
|
||||
{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)]),
|
||||
http_response(404);
|
||||
{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)]),
|
||||
http_response(404);
|
||||
{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)]),
|
||||
http_response(500)
|
||||
end;
|
||||
@ -572,7 +572,7 @@ create_slot(#state{service_url = undefined, max_size = MaxSize},
|
||||
when MaxSize /= infinity,
|
||||
Size > 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]),
|
||||
Error = xmpp:err_not_acceptable(Text, Lang),
|
||||
Els = xmpp:get_els(Error),
|
||||
@ -629,15 +629,15 @@ create_slot(#state{service_url = ServiceURL},
|
||||
{error, xmpp:err_service_unavailable(Txt, Lang)}
|
||||
end;
|
||||
{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]),
|
||||
{error, xmpp:err_resource_constraint()};
|
||||
{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]),
|
||||
{error, xmpp:err_not_allowed()};
|
||||
{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]),
|
||||
{error, xmpp:err_not_acceptable()};
|
||||
{ok, {Code, _Body}} ->
|
||||
|
@ -151,7 +151,7 @@ request(Req, SIPSock, TrID, Action) ->
|
||||
mod_sip_proxy:route(Req, SIPSock, TrID, Pid),
|
||||
{mod_sip_proxy, route, [Pid]};
|
||||
Err ->
|
||||
?INFO_MSG("failed to proxy request ~p: ~p", [Req, Err]),
|
||||
?WARNING_MSG("Failed to proxy request ~p: ~p", [Req, Err]),
|
||||
Err
|
||||
end;
|
||||
{proxy_auth, LServer} ->
|
||||
|
@ -446,8 +446,8 @@ handle_resume(#{user := User, lserver := LServer,
|
||||
[xmpp_socket:pp(Socket), jid:encode(JID)]),
|
||||
{ok, State5};
|
||||
{error, El, Msg} ->
|
||||
?INFO_MSG("Cannot resume session for ~s@~s: ~s",
|
||||
[User, LServer, Msg]),
|
||||
?WARNING_MSG("Cannot resume session for ~s@~s: ~s",
|
||||
[User, LServer, Msg]),
|
||||
{error, send(State, El)}
|
||||
end.
|
||||
|
||||
|
@ -60,8 +60,8 @@ from_dir(ProsodyDir) ->
|
||||
Err
|
||||
end;
|
||||
{error, _} = Err ->
|
||||
?INFO_MSG("The file 'luerl.beam' is not found: maybe "
|
||||
"ejabberd is not compiled with Lua support", []),
|
||||
?ERROR_MSG("The file 'luerl.beam' is not found: maybe "
|
||||
"ejabberd is not compiled with Lua support", []),
|
||||
Err
|
||||
end.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user