Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #36573

Re: Why BOM in logging message?

From roy@panix.com (Roy Smith)
Newsgroups comp.lang.python
Subject Re: Why BOM in logging message?
Date 2013-01-10 11:06 -0500
Organization PANIX -- Public Access Networks Corp.
Message-ID <kcmoug$rk4$1@panix2.panix.com> (permalink)
References <kcksg2$bkp$1@panix2.panix.com> <mailman.344.1357772847.2939.python-list@python.org> <roy-10B053.20174309012013@news.panix.com>

Show all headers | View raw


In article <roy-10B053.20174309012013@news.panix.com>,
Roy Smith  <roy@panix.com> wrote:
>In article <mailman.344.1357772847.2939.python-list@python.org>,
> Chris Angelico <rosuav@gmail.com> wrote:
>
>> On Thu, Jan 10, 2013 at 9:54 AM, Roy Smith <roy@panix.com> wrote:
>> > What's weird is that two of the servers, and only those two, stick a
>> > BOM (Byte Order Mark) in front of the message they log.
>> 
>> Could it be this issue you're looking at?
>> 
>> http://bugs.python.org/issue14452
>> 
>> What are the exact Python versions in use? Are the two different
>> servers running an older revision of Py 2.7?
>> 
>> ChrisA
>
>It sounds like it might be it, but we're running 2.7.3 on all machines.

Well, this is fascinating.  It turns out that while all of our
machines report that they're running 2.7.3, they have two different
versions of /usr/lib/python2.7/logging/handlers.py!

-rw-r--r-- 1 root root 45076 Aug  1 05:39 /usr/lib/python2.7/logging/handlers.py
-rw-r--r-- 1 root root 45143 Apr 20  2012 /usr/lib/python2.7/logging/handlers.py

The April 24th version has the BOM code in SysLogHander.emit():

|         # Message is a string. Convert to bytes as required by RFC 5424
|        if type(msg) is unicode:
|            msg = msg.encode('utf-8')
|            if codecs:
|                msg = codecs.BOM_UTF8 + msg
|        msg = prio + msg

and the August 1st version doesn't:

|        # Message is a string. Convert to bytes as required by RFC 5424
|        if type(msg) is unicode:
|            msg = msg.encode('utf-8')
|        msg = prio + msg

Is it possible there's two different 2.7.3 builds that somehow got
packaged by Ubuntu at different times?  The pattern of which machines
have the August code and which have the April code correlates with
when we rolled out each server instance.

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Why BOM in logging message? roy@panix.com (Roy Smith) - 2013-01-09 17:54 -0500
  Re: Why BOM in logging message? Chris Angelico <rosuav@gmail.com> - 2013-01-10 10:07 +1100
    Re: Why BOM in logging message? Roy Smith <roy@panix.com> - 2013-01-09 20:17 -0500
      Re: Why BOM in logging message? roy@panix.com (Roy Smith) - 2013-01-10 11:06 -0500
        Re: Why BOM in logging message? Chris Angelico <rosuav@gmail.com> - 2013-01-11 03:16 +1100
          Re: Why BOM in logging message? roy@panix.com (Roy Smith) - 2013-01-10 11:40 -0500
            Re: Why BOM in logging message? Chris Angelico <rosuav@gmail.com> - 2013-01-11 03:52 +1100
        Re: Why BOM in logging message? Terry Reedy <tjreedy@udel.edu> - 2013-01-10 18:45 -0500
  Re: Why BOM in logging message? John Gordon <gordon@panix.com> - 2013-01-09 23:19 +0000
    Re: Why BOM in logging message? Roy Smith <roy@panix.com> - 2013-01-09 20:17 -0500

csiph-web