Fix error logging to actually print error and stack trace for caught errors
authorDavid Reiss <dreiss@apache.org>
Wed, 11 Jun 2008 00:56:42 +0000 (00:56 +0000)
committerDavid Reiss <dreiss@apache.org>
Wed, 11 Jun 2008 00:56:42 +0000 (00:56 +0000)
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666408 13f79535-47bb-0310-9956-ffa450edef68

lib/alterl/src/thrift_processor.erl

index 8cc53c3..8e077b8 100644 (file)
@@ -122,11 +122,14 @@ handle_unknown_exception(State, Function, Exception) ->
                                    Exception}).
 
 handle_error(#state{out_protocol = OProto}, Function, Error) ->
+    Stack = erlang:get_stacktrace(),
+    error_logger:error_msg("~p had an error: ~p~n", [Function, {Error, Stack}]),
+    
     Message =
         case application:get_env(thrift, exceptions_include_traces) of
             {ok, true} ->
                 lists:flatten(io_lib:format("An error occurred: ~p~n",
-                                            [{Error, erlang:get_stacktrace()}]));
+                                            [{Error, Stack}]));
             _ ->
                 "An unknown handler error occurred."
         end,