Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #36523
| From | roy@panix.com (Roy Smith) |
|---|---|
| Newsgroups | comp.lang.python |
| Subject | Why BOM in logging message? |
| Date | 2013-01-09 17:54 -0500 |
| Organization | PANIX -- Public Access Networks Corp. |
| Message-ID | <kcksg2$bkp$1@panix2.panix.com> (permalink) |
We've got 10 (supposedly) identical servers, all running Ubuntu 12.04,
Python 2.7, Django 1.3. We log to syslog using the logging module and
a custom fomatter.
'formatters': {
'verbose': {
'format': '%(asctime)s [%(process)d]: %(program)s %(session_id)s %(request_id)s %(request_id_digest)s %(remote_addr)s %(name)s %(level\
name)s %(funcName)s() %(message)s',
'()': 'songza.logging.ContextFormatter',
},
},
There's nothing particularly exciting in the formatter code:
class ContextFormatter(logging.Formatter):
def format(self, record):
record.program = context.get_program()
record.request_id = context.get_request_id()
record.request_id_digest = context.get_request_id_digest()
record.session_id = context.get_session_id() or '-'
record.remote_addr = context.get_remote_addr() or '-'
return logging.Formatter.format(self, record)
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. It shows up
in syslog as:
2013-01-09T00:00:00+00:00 web5.songza.com <U+FEFF>2013-01-0900:00:00,754 [18979]: [etc...]
The other machines, never put the BOM in. Given that all 10 machines
are ostensibly clones of each other, we're scratching our heads what
might be different about those two which cause the BOMs to appear.
Any ideas?
I suppose it's possible it's a syslog config problem and not a Python
problem, but I figured I'd start at the beginning of the chain.
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll 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