couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rand...@apache.org
Subject git commit: restore some log messages after 04c4a10
Date Mon, 19 Mar 2012 22:56:15 GMT
Updated Branches:
  refs/heads/1.2.x eaa9c4aee -> ede9482fc


restore some log messages after 04c4a10


Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/ede9482f
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/ede9482f
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/ede9482f

Branch: refs/heads/1.2.x
Commit: ede9482fc3c9e629572ab1376d88f4499c4c8beb
Parents: eaa9c4a
Author: Randall Leeds <randall@apache.org>
Authored: Mon Mar 19 15:54:08 2012 -0700
Committer: Randall Leeds <randall@apache.org>
Committed: Mon Mar 19 15:54:08 2012 -0700

----------------------------------------------------------------------
 src/couchdb/couch_file.erl |    7 ++++++-
 src/couchdb/couch_log.erl  |    6 ++++--
 2 files changed, 10 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/ede9482f/src/couchdb/couch_file.erl
----------------------------------------------------------------------
diff --git a/src/couchdb/couch_file.erl b/src/couchdb/couch_file.erl
index 5e476af..7725ddc 100644
--- a/src/couchdb/couch_file.erl
+++ b/src/couchdb/couch_file.erl
@@ -53,14 +53,19 @@ open(Filepath, Options) ->
     ignore ->
         % get the error
         receive
-        {Ref, Pid, Error} ->
+        {Ref, Pid, {error, Reason} = Error} ->
             case process_info(self(), trap_exit) of
             {trap_exit, true} -> receive {'EXIT', Pid, _} -> ok end;
             {trap_exit, false} -> ok
             end,
+            ?LOG_ERROR("Error opening file ~s: ~s",
+                [Filepath, file:format_error(Reason)]),
             Error
         end;
     Error ->
+        % We can't say much here, because it could be any kind of error.
+        % Just let it bubble and an encapsulating subcomponent can perhaps
+        % be more informative. It will likely appear in the SASL log, anyway.
         Error
     end.
 

http://git-wip-us.apache.org/repos/asf/couchdb/blob/ede9482f/src/couchdb/couch_log.erl
----------------------------------------------------------------------
diff --git a/src/couchdb/couch_log.erl b/src/couchdb/couch_log.erl
index 7fb95a7..f299ba7 100644
--- a/src/couchdb/couch_log.erl
+++ b/src/couchdb/couch_log.erl
@@ -89,8 +89,10 @@ init([]) ->
     case file:open(Filename, [append]) of
     {ok, Fd} ->
         {ok, #state{fd = Fd, level = Level, sasl = Sasl}};
-    Error ->
-        {stop, Error}
+    {error, Reason} ->
+        ReasonStr = file:format_error(Reason),
+        io:format("Error opening log file ~s: ~s", [Filename, ReasonStr]),
+        {stop, {error, ReasonStr, Filename}}
     end.
 
 debug_on() ->


Mime
View raw message