couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fdman...@apache.org
Subject svn commit: r1101896 - /couchdb/trunk/src/couchdb/couch_log.erl
Date Wed, 11 May 2011 14:26:22 GMT
Author: fdmanana
Date: Wed May 11 14:26:21 2011
New Revision: 1101896

URL: http://svn.apache.org/viewvc?rev=1101896&view=rev
Log:
Fix logger crash when messages have unicode characters

This closes COUCHDB-1158. Thanks Dale Harvey.

Modified:
    couchdb/trunk/src/couchdb/couch_log.erl

Modified: couchdb/trunk/src/couchdb/couch_log.erl
URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_log.erl?rev=1101896&r1=1101895&r2=1101896&view=diff
==============================================================================
--- couchdb/trunk/src/couchdb/couch_log.erl (original)
+++ couchdb/trunk/src/couchdb/couch_log.erl Wed May 11 14:26:21 2011
@@ -167,10 +167,10 @@ log(#state{fd = 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"),



Mime
View raw message