You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by fd...@apache.org on 2011/05/11 17:32:03 UTC

svn commit: r1101924 - /couchdb/branches/1.1.x/src/couchdb/couch_log.erl

Author: fdmanana
Date: Wed May 11 15:32:03 2011
New Revision: 1101924

URL: http://svn.apache.org/viewvc?rev=1101924&view=rev
Log:
Merged revision 1101896 from trunk

    Fix logger crash when messages have unicode characters

    This closes COUCHDB-1158. Thanks Dale Harvey.


Modified:
    couchdb/branches/1.1.x/src/couchdb/couch_log.erl

Modified: couchdb/branches/1.1.x/src/couchdb/couch_log.erl
URL: http://svn.apache.org/viewvc/couchdb/branches/1.1.x/src/couchdb/couch_log.erl?rev=1101924&r1=1101923&r2=1101924&view=diff
==============================================================================
--- couchdb/branches/1.1.x/src/couchdb/couch_log.erl (original)
+++ couchdb/branches/1.1.x/src/couchdb/couch_log.erl Wed May 11 15:32:03 2011
@@ -174,10 +174,10 @@ log(Fd, ConsoleMsg, FileMsg) ->
     ok = io:put_chars(Fd, FileMsg).
 
 get_log_messages(Pid, Level, Format, Args) ->
-    ConsoleMsg = io_lib:format(
-        "[~s] [~p] " ++ Format ++ "~n", [Level, Pid | Args]),
+    ConsoleMsg = unicode:characters_to_binary(io_lib:format(
+        "[~s] [~p] " ++ Format ++ "~n", [Level, Pid | Args])),
     FileMsg = ["[", httpd_util:rfc1123_date(), "] ", ConsoleMsg],
-    {iolist_to_binary(ConsoleMsg), iolist_to_binary(FileMsg)}.
+    {ConsoleMsg, iolist_to_binary(FileMsg)}.
 
 read(Bytes, Offset) ->
     LogFileName = couch_config:get("log", "file"),