aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEvgeny Khramtsov <ekhramtsov@process-one.net>2018-09-19 23:12:14 +0300
committerEvgeny Khramtsov <ekhramtsov@process-one.net>2018-09-19 23:12:14 +0300
commit08f3d066b11d746c0f23e252f237fa42cb0f7321 (patch)
treece36f0f98649f5d6161b5558428ffd72fb73c0e2 /src
parentSwitch mod_fail2ban log messages to warning level (diff)
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
Diffstat (limited to 'src')
-rw-r--r--src/acl.erl2
-rw-r--r--src/ejabberd_c2s.erl16
-rw-r--r--src/ejabberd_http.erl4
-rw-r--r--src/ejabberd_s2s_in.erl6
-rw-r--r--src/ejabberd_s2s_out.erl20
-rw-r--r--src/ejabberd_service.erl18
-rw-r--r--src/ejabberd_sql.erl9
-rw-r--r--src/ejabberd_sql_sup.erl6
-rw-r--r--src/ejabberd_web_admin.erl4
-rw-r--r--src/eldap_pool.erl2
-rw-r--r--src/mod_http_upload.erl20
-rw-r--r--src/mod_sip.erl2
-rw-r--r--src/mod_stream_mgmt.erl4
-rw-r--r--src/prosody2ejabberd.erl4
14 files changed, 58 insertions, 59 deletions
diff --git a/src/acl.erl b/src/acl.erl
index f0c437b02..1bffd8fa9 100644
--- a/src/acl.erl
+++ b/src/acl.erl
@@ -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 ->
diff --git a/src/ejabberd_c2s.erl b/src/ejabberd_c2s.erl
index 78eebbfb7..cdf4f9d6f 100644
--- a/src/ejabberd_c2s.erl
+++ b/src/ejabberd_c2s.erl
@@ -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) ->
diff --git a/src/ejabberd_http.erl b/src/ejabberd_http.erl
index f47304813..40e85d982 100644
--- a/src/ejabberd_http.erl
+++ b/src/ejabberd_http.erl
@@ -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
diff --git a/src/ejabberd_s2s_in.erl b/src/ejabberd_s2s_in.erl
index dee01250a..f7f4f97da 100644
--- a/src/ejabberd_s2s_in.erl
+++ b/src/ejabberd_s2s_in.erl
@@ -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]).
diff --git a/src/ejabberd_s2s_out.erl b/src/ejabberd_s2s_out.erl
index 3c40d805a..db8f3d0a3 100644
--- a/src/ejabberd_s2s_out.erl
+++ b/src/ejabberd_s2s_out.erl
@@ -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) ->
diff --git a/src/ejabberd_service.erl b/src/ejabberd_service.erl
index 02302a838..0f40822b7 100644
--- a/src/ejabberd_service.erl
+++ b/src/ejabberd_service.erl
@@ -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)
diff --git a/src/ejabberd_sql.erl b/src/ejabberd_sql.erl
index e6c5c0212..1c8858410 100644
--- a/src/ejabberd_sql.erl
+++ b/src/ejabberd_sql.erl
@@ -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,
diff --git a/src/ejabberd_sql_sup.erl b/src/ejabberd_sql_sup.erl
index eaaef5fc8..ee889bd21 100644
--- a/src/ejabberd_sql_sup.erl
+++ b/src/ejabberd_sql_sup.erl
@@ -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) ->
diff --git a/src/ejabberd_web_admin.erl b/src/ejabberd_web_admin.erl
index c7bded027..03b11c9f6 100644
--- a/src/ejabberd_web_admin.erl
+++ b/src/ejabberd_web_admin.erl
@@ -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,
diff --git a/src/eldap_pool.erl b/src/eldap_pool.erl
index 647ff02e2..3e8e35b84 100644
--- a/src/eldap_pool.erl
+++ b/src/eldap_pool.erl
@@ -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,
diff --git a/src/mod_http_upload.erl b/src/mod_http_upload.erl
index 220ca1a64..fe3379f16 100644
--- a/src/mod_http_upload.erl
+++ b/src/mod_http_upload.erl
@@ -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}} ->
diff --git a/src/mod_sip.erl b/src/mod_sip.erl
index daed4fa19..814b9df6f 100644
--- a/src/mod_sip.erl
+++ b/src/mod_sip.erl
@@ -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} ->
diff --git a/src/mod_stream_mgmt.erl b/src/mod_stream_mgmt.erl
index f897a2794..de10654e7 100644
--- a/src/mod_stream_mgmt.erl
+++ b/src/mod_stream_mgmt.erl
@@ -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.
diff --git a/src/prosody2ejabberd.erl b/src/prosody2ejabberd.erl
index 7da288c32..b95faad51 100644
--- a/src/prosody2ejabberd.erl
+++ b/src/prosody2ejabberd.erl
@@ -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.