odbc and ssl applications use error_logger:error_report/2 instead of error_logger:error_msg/2

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

odbc and ssl applications use error_logger:error_report/2 instead of error_logger:error_msg/2

Matthew Dempsky-3
While looking for idiomatic uses of error_logger:error_report in the
OTP distribution, I noticed that the odbc and ssl applications call
error_logger:error_report/2 with arguments that look intended for
error_logger:error_msg/2.  The patch below corrects this.

--- odbc/src/odbc.erl.orig 2008-04-05 21:00:25.000000000 -0700
+++ odbc/src/odbc.erl 2008-04-05 21:01:03.000000000 -0700
@@ -678,8 +678,8 @@
  ok ->
     ok;
  {error, Reason} ->
-    error_logger:error_report("ODBC could not end connection "
-      "gracefully due to ~p~n", [Reason])
+    error_logger:error_msg("ODBC could not end connection "
+                                   "gracefully due to ~p~n", [Reason])
     end,

     {stop, normal, State#state{reply_to = undefined}};
@@ -754,8 +754,7 @@
 %% so we do not want to crash, but we make a log entry as it is an
 %% unwanted behaviour.)
 handle_info(Info, State) ->
-    error_logger:error_report("ODBC: received unexpected info: ~p~n",
-      [Info]),
+    error_logger:error_msg("ODBC: received unexpected info: ~p~n", [Info]),
     {noreply, State}.

 %%--------------------------------------------------------------------------
--- ssl/src/ssl_handshake.erl.orig 2008-04-05 21:05:12.000000000 -0700
+++ ssl/src/ssl_handshake.erl 2008-04-05 21:05:52.000000000 -0700
@@ -274,8 +274,8 @@
     Result
     catch
  exit:Reason ->
-    error_logger:error_report("Key calculation failed due to ~p",
-      [Reason]),
+    error_logger:error_msg("Key calculation failed due to ~p~n",
+                                   [Reason]),
     #alert{level = ?FATAL, description = ?HANDSHAKE_FAILURE}
     end;

@@ -294,8 +294,8 @@

     catch
  exit:Reason ->
-    error_logger:error_report("Master secret calculation failed"
-      " due to ~p", [Reason]),
+    error_logger:error_msg("Master secret calculation failed"
+                                   " due to ~p~n", [Reason]),
     #alert{level = ?FATAL, description = ?HANDSHAKE_FAILURE}
     end.


Reply | Threaded
Open this post in threaded view
|

odbc and ssl applications use error_logger:error_report/2 instead of error_logger:error_msg/2

Ingela Anderton Andin-2
Hi!

Thank you for reporting this. Indeed there needs to be a change in the code.
I have created a ticket for this.

Regards Ingela  - OTP team

Matthew Dempsky wrote:

> While looking for idiomatic uses of error_logger:error_report in the
> OTP distribution, I noticed that the odbc and ssl applications call
> error_logger:error_report/2 with arguments that look intended for
> error_logger:error_msg/2.  The patch below corrects this.
>
> --- odbc/src/odbc.erl.orig 2008-04-05 21:00:25.000000000 -0700
> +++ odbc/src/odbc.erl 2008-04-05 21:01:03.000000000 -0700
> @@ -678,8 +678,8 @@
>   ok ->
>      ok;
>   {error, Reason} ->
> -    error_logger:error_report("ODBC could not end connection "
> -      "gracefully due to ~p~n", [Reason])
> +    error_logger:error_msg("ODBC could not end connection "
> +                                   "gracefully due to ~p~n", [Reason])
>      end,
>
>      {stop, normal, State#state{reply_to = undefined}};
> @@ -754,8 +754,7 @@
>  %% so we do not want to crash, but we make a log entry as it is an
>  %% unwanted behaviour.)
>  handle_info(Info, State) ->
> -    error_logger:error_report("ODBC: received unexpected info: ~p~n",
> -      [Info]),
> +    error_logger:error_msg("ODBC: received unexpected info: ~p~n", [Info]),
>      {noreply, State}.
>
>  %%--------------------------------------------------------------------------
> --- ssl/src/ssl_handshake.erl.orig 2008-04-05 21:05:12.000000000 -0700
> +++ ssl/src/ssl_handshake.erl 2008-04-05 21:05:52.000000000 -0700
> @@ -274,8 +274,8 @@
>      Result
>      catch
>   exit:Reason ->
> -    error_logger:error_report("Key calculation failed due to ~p",
> -      [Reason]),
> +    error_logger:error_msg("Key calculation failed due to ~p~n",
> +                                   [Reason]),
>      #alert{level = ?FATAL, description = ?HANDSHAKE_FAILURE}
>      end;
>
> @@ -294,8 +294,8 @@
>
>      catch
>   exit:Reason ->
> -    error_logger:error_report("Master secret calculation failed"
> -      " due to ~p", [Reason]),
> +    error_logger:error_msg("Master secret calculation failed"
> +                                   " due to ~p~n", [Reason]),
>      #alert{level = ?FATAL, description = ?HANDSHAKE_FAILURE}
>      end.
> _______________________________________________
> erlang-patches mailing list
> erlang-patches
> http://www.erlang.org/mailman/listinfo/erlang-patches
>
>