[thrift] erlang: log more tTransportExceptions

Summary: all tTEs were being filtered from the logs; now just tTEs that come from connections closing are suppressed

Test Plan: logs my bug in channel server :)

Notes: adds logic to thrift_logger, not removes (bad news bears)


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665199 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/erl/lib/thrift/src/thrift_logger.erl b/lib/erl/lib/thrift/src/thrift_logger.erl
index 82ba772..12aa059 100644
--- a/lib/erl/lib/thrift/src/thrift_logger.erl
+++ b/lib/erl/lib/thrift/src/thrift_logger.erl
@@ -10,6 +10,15 @@
 
 -include("thrift_logger.hrl").
 
+%% TODO(cpiro): either
+%% make exceptions know whether they need to be displayed
+%% or not exit with tExecptions for non-errors
+%% or "register" tExceptions with the logger (I LIKE!)
+%% ... we shouldn't need to build any specifics in here
+-include("thrift.hrl").
+-include("oop.hrl").
+-include("transport/tTransportException.hrl").
+
 %% gen_event callbacks
 -export([init/1, handle_event/2, handle_call/2, 
          handle_info/2, terminate/2, code_change/3]).
@@ -138,8 +147,20 @@
 	    [Pid, LastMessage, Obj, Reason] = Data,
 
 	    %% TODO: move as much logic as possible out of thrift_logger
-	    Ignore = (is_tuple(Reason) andalso size(Reason) >= 1 andalso element(1, Reason) == timeout)
-		orelse error /= thrift_utils:unnest_record(Reason, tTransportException),
+	    Ignore =
+		begin
+		    is_tuple(Reason) andalso
+			size(Reason) >= 1 andalso element(1, Reason) == timeout
+		end
+		orelse
+		begin
+		    case thrift_utils:unnest_record(Reason, tTransportException) of
+			error -> false;
+			{ok, TTE} ->
+			    oop:get(TTE, type) == ?tTransportException_NOT_OPEN andalso
+				oop:get(TTE, message) == "in tSocket:read/2: gen_tcp:recv"
+		    end
+		end,
 
 	    case Ignore of
 		true ->