From 52d18a368aeb1f67cb9dc35ff9135b558a196399 Mon Sep 17 00:00:00 2001 From: Filipe David Borba Manana Date: Wed, 11 May 2011 15:32:03 +0000 Subject: Merged revision 1101896 from trunk Fix logger crash when messages have unicode characters This closes COUCHDB-1158. Thanks Dale Harvey. git-svn-id: https://svn.apache.org/repos/asf/couchdb/branches/1.1.x@1101924 13f79535-47bb-0310-9956-ffa450edef68 --- src/couchdb/couch_log.erl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/couchdb/couch_log.erl b/src/couchdb/couch_log.erl index 9813f812..b3d3297c 100644 --- a/src/couchdb/couch_log.erl +++ b/src/couchdb/couch_log.erl @@ -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"), -- cgit v1.2.3