]> granicus.if.org Git - ejabberd/commitdiff
Switch more log message to warning level
authorEvgeny Khramtsov <ekhramtsov@process-one.net>
Wed, 19 Sep 2018 20:12:14 +0000 (23:12 +0300)
committerEvgeny Khramtsov <ekhramtsov@process-one.net>
Wed, 19 Sep 2018 20:12:14 +0000 (23:12 +0300)
The commit is supposed to improve logging at loglevel 3, which
is the recommended level for high loaded ejabberd servers

14 files changed:
src/acl.erl
src/ejabberd_c2s.erl
src/ejabberd_http.erl
src/ejabberd_s2s_in.erl
src/ejabberd_s2s_out.erl
src/ejabberd_service.erl
src/ejabberd_sql.erl
src/ejabberd_sql_sup.erl
src/ejabberd_web_admin.erl
src/eldap_pool.erl
src/mod_http_upload.erl
src/mod_sip.erl
src/mod_stream_mgmt.erl
src/prosody2ejabberd.erl

index f0c437b029d55d32b59f61a74c7e6263b69889bc..1bffd8fa9b9173d227651561398f9e7f728c9960 100644 (file)
@@ -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 ->
index 78eebbfb703259eaa6d39beb3715bbada7e1c084..cdf4f9d6fc1f0911b21588a360afe4cf20b9bc20 100644 (file)
@@ -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) ->
index f4730481347bc119bf3e19432349b28405e85d0b..40e85d9823f283fd00e9e5235fcaa804ef8c5475 100644 (file)
@@ -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
index dee01250a549135c1aff3af40b6a428ae880f9a6..f7f4f97da8136699a2a3b28be5ea54fc71f1bade 100644 (file)
@@ -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]).
 
index 3c40d805ad0bad0dd69e5145267fc3fde311f7b1..db8f3d0a36f97834341765b726b5d91f6d1e10cc 100644 (file)
@@ -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) ->
index 02302a838038747787e571cf483f7f1c971af0d3..0f40822b7df7822156d9e0e72072927774e1d00a 100644 (file)
@@ -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)
index e6c5c0212862376c71068be005b702be2e69733a..1c8858410329a04319ead43598d755d9ee9ba83f 100644 (file)
@@ -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,
index eaaef5fc899252945178a1116d6af6b9b0f4680a..ee889bd21738bdb2faf676ee757ff4f6d0b9c250 100644 (file)
@@ -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) ->
index c7bded027308d3a4b022b874b35db1b91abe421c..03b11c9f60b08d11bf58a6d2ca2c89f75c910e79 100644 (file)
@@ -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,
index 647ff02e28c30044147d4e28a7a4dcb43c9ae186..3e8e35b844981e801d580265b736e555d4e558af 100644 (file)
@@ -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,
index 220ca1a640bbf71b3bdc7145868bacaad92b2e7f..fe3379f16985a2f4e0be2f2a24f00f6324eee0bf 100644 (file)
@@ -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}} ->
index daed4fa19ad0d5c91c1f0b0b18f9b049c3ad8299..814b9df6f7683623777cea936109076caff9eb98 100644 (file)
@@ -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} ->
index f897a2794f85e5bd86696a3b3ac3b5309011038b..de10654e7a5ff21de21d8119123a4d482cc5cb55 100644 (file)
@@ -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.
 
index 7da288c325f83d4771398777e06daaf937a7f7dc..b95faad51c5ff8a77794aa7a03c6b8b6831ca134 100644 (file)
@@ -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.