Received: from magus.postgresql.org (magus.postgresql.org [87.238.57.229]) by mail.postgresql.org (Postfix) with ESMTP id DA8BEF6332A; Thu, 19 Jul 2012 04:23:59 -0300 (ADT) Received: from mail-lb0-f174.google.com ([209.85.217.174]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1Srl5Y-0008Uv-7a; Thu, 19 Jul 2012 07:23:59 +0000 Received: by lbbgm6 with SMTP id gm6so3202004lbb.19 for ; Thu, 19 Jul 2012 00:23:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=FgPjeOnT9pK4Cc187isvpdzhe4VTCUoa6hOA6bCpOwg=; b=DLkzUXlqj6ncTizHy/3/ErJaaK/t14cuwZM5bsU5A8oWPC72vAjMjNMdCy8C6U7jx2 R5KTEKhyKUh37WH86XfXxTV9NoYYq9Y/J6NcYM4exTz/CbD2jhsBcfRs1srXojZseKFL uk4H783awWmTrnTWT5Sw2ylIhjmm6Wn9qZNGWZtnun4ai994ZdpAc0t7LK/AzjyhBIDa xvPA+hB2F0vnEDWgplpcuEmiaR004DJ+Bw60XN8KrLIeI8wjPRlTRhz01XkfXs5J5BjQ 5yRy5ZJvqzLqCWbpQXvfQ2o4csaOqOKywPBmQOQQohQu58LPxOyYSKc/aokQsJRTodWr Gc8Q== Received: by 10.152.108.144 with SMTP id hk16mr889735lab.2.1342682622899; Thu, 19 Jul 2012 00:23:42 -0700 (PDT) Received: from [1.0.0.7] ([94.138.26.200]) by mx.google.com with ESMTPS id er3sm301063lbb.16.2012.07.19.00.23.40 (version=SSLv3 cipher=OTHER); Thu, 19 Jul 2012 00:23:41 -0700 (PDT) Message-ID: <5007B5FB.4020208@gmail.com> Date: Thu, 19 Jul 2012 11:23:39 +0400 From: Alexander Law User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:14.0) Gecko/20120714 Thunderbird/14.0 MIME-Version: 1.0 To: Craig Ringer CC: pgsql-general@postgresql.org, yi.codeplayer@gmail.com, Pg Bugs Subject: Re: main log encoding problem References: <1331925178-sup-9261@alvh.no-ip.org> <4F65A533.7090208@gmail.com> <1332187409-sup-4631@alvh.no-ip.org> <50067916.8010508@gmail.com> <5006D340.4000808@gmail.com> <50078B96.8020206@ringerc.id.au> In-Reply-To: <50078B96.8020206@ringerc.id.au> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -2.7 (--) X-Archive-Number: 201207/156 X-Sequence-Number: 33632 Hello, > > Implementing any of these isn't trivial - especially making sure > messages emitted to stderr from things like segfaults and dynamic > linker messages are always correct. Ensuring that the logging > collector knows when setlocale() has been called to change the > encoding and translation of system messages, handling the different > logging output methods, etc - it's going to be fiddly. > > I have some performance concerns about the transcoding required for > (b) or (c), but realistically it's already the norm to convert all the > data sent to and from clients. Conversion for logging should not be a > significant additional burden. Conversion can be short-circuited out > when source and destination encodings are the same for the common case > of logging in utf-8 or to a dedicated file. > The initial issue was that log file contains messages in different encodings. So transcoding is performed already, but it's not consistent and in my opinion this is the main problem. > I suspect the eventual choice will be "all of the above": > > - Default to (b) or (c), both have pros and cons. I favour (c) with a > UTF-8 BOM to warn editors, but (b) is nice for people whose DBs are > all in the system locale. As I understand UTF-8 is the default encoding for databases. And even when a database is in the system encoding, translated postgres messages still come in UTF-8 and will go through UTF-8 -> System locale conversion within gettext. > > - Allow (a) for people who have many different DBs in many different > encodings, do high volume logging, and want to avoid conversion > overhead. Let them deal with the mess, just provide an additional % > code for the encoding so they can name their per-DB log files to > indicate the encoding. > I think that (a) solution can be an evolvement of the logging mechanism if there will be a need for it. > The main issue is just that code needs to be prototyped, cleaned up, > and submitted. So far nobody's cared enough to design it, build it, > and get it through patch review. I've just foolishly volunteered > myself to work on an automated crash-test system for virtual plug-pull > testing, so I'm not stepping up. > I see you point and I can prepare a prototype if the proposed (c) solution seems reasonable enough and can be accepted. Best regards, Alexander