Re: SMTPHandler and Unicode

2012-01-14 Thread Chris Withers
On 13/01/2012 20:17, Chris Withers wrote: Your package has the same unicode problem : import logging,logging.handlers from mailinglogger.MailingLogger import MailingLogger mailingLogger = MailingLogger(mailhost=('smtp.example.com', 25),fromaddr='t...@example.com',toaddrs=('t...@example.com',)) LO

Re: SMTPHandler and Unicode

2012-01-14 Thread Chris Withers
Hi Norbert, On 05/07/2010 13:22, norbert wrote: On 5 juil, 13:17, Chris Withers wrote: try MailingLogger: If you have unicode problems with that, I'd be interested in fixing them! Your package has the same unicode problem : import logging,logging.handlers from mailinglogger.MailingLogger im

Re: SMTPHandler and Unicode

2010-07-07 Thread norbert
> Well, you could use an approach like the one suggested here: > > http://plumberjack.blogspot.com/2010/07/using-custom-formatter-to-dea... That's nice, thanks. I'll use something like this. Just a thought : I will use "errors=replace" in the call to the encode method to be sure that the logger do

Re: SMTPHandler and Unicode

2010-07-06 Thread Vinay Sajip
norbert gmail.com> writes: > > crash with a UnicodeError. I can't see any workaround, except by > subclassing SMTPHandler's emit method to be unicode-aware or at least > URF-8 aware. > Well, you could use an approach like the one suggested here: http://plumberjack.blogspot.com/2010/07/using-

Re: SMTPHandler and Unicode

2010-07-05 Thread Vinay Sajip
On Jul 5, 2:35 pm, Antoine Pitrou wrote: > > a FileHandler works as expected, the log file being UTF-8 encoded. > > Ouch. Implicit encoding sounds like a bad behaviour. UTF-8 is only used as a fallback in an exception handler, you can use any supported encoding using the encoding= keyword argumen

Re: SMTPHandler and Unicode

2010-07-05 Thread norbert
> > Ouch. Implicit encoding sounds like a bad behaviour. Looking at the FileHandler source ( http://svn.python.org/view/python/trunk/Lib/logging/__init__.py?view=markup ) : the utf-8 encoding is a fallback. But *FileHandler family let you specify the encoding you want, so that's OK I think. But S

Re: SMTPHandler and Unicode

2010-07-05 Thread Chris Withers
Antoine Pitrou wrote: On Mon, 5 Jul 2010 06:17:38 -0700 (PDT) norbert wrote: a FileHandler works as expected, the log file being UTF-8 encoded. Ouch. Implicit encoding sounds like a bad behaviour. Yes indeed, hence my question on python-dev... Chris -- Simplistix - Content Management, Bat

Re: SMTPHandler and Unicode

2010-07-05 Thread Antoine Pitrou
On Mon, 5 Jul 2010 06:17:38 -0700 (PDT) norbert wrote: > > a FileHandler works as expected, the log file being UTF-8 encoded. Ouch. Implicit encoding sounds like a bad behaviour. > The > SMTPHandler is the only logger I know with this problem, maybe > connected to SMTPLib implementation ? I su

Re: SMTPHandler and Unicode

2010-07-05 Thread norbert
On 5 juil, 14:32, Chris Withers wrote: > norbert wrote: > > Your package has the same unicode problem : > > import logging,logging.handlers > > from mailinglogger.MailingLogger import MailingLogger > > mailingLogger = MailingLogger(mailhost=('smtp.example.com', > > 25),fromaddr='t...@example.com',

Re: SMTPHandler and Unicode

2010-07-05 Thread Chris Withers
norbert wrote: Your package has the same unicode problem : import logging,logging.handlers from mailinglogger.MailingLogger import MailingLogger mailingLogger = MailingLogger(mailhost=('smtp.example.com', 25),fromaddr='t...@example.com',toaddrs=('t...@example.com',)) LOG = logging.getLogger() LOG

Re: SMTPHandler and Unicode

2010-07-05 Thread norbert
On 5 juil, 13:17, Chris Withers wrote: > try MailingLogger: > > If you have unicode problems with that, I'd be interested in fixing them! Your package has the same unicode problem : import logging,logging.handlers from mailinglogger.MailingLogger import MailingLogger mailingLogger = MailingLogger

Re: SMTPHandler and Unicode

2010-07-05 Thread Chris Withers
norbert wrote: I want to send error messages with SMTPHandler logging. But SMTPHandler does not seem to be unicode aware. Is there something doable without playing with sys.setdefaultencoding ? try MailingLogger: http://www.simplistix.co.uk/software/python/mailinglogger If you have unicode pr

SMTPHandler and Unicode

2010-07-05 Thread norbert
Hello, I want to send error messages with SMTPHandler logging. But SMTPHandler does not seem to be unicode aware. Is there something doable without playing with sys.setdefaultencoding ? import logging,logging.handlers smtpHandler = logging.handlers.SMTPHandler(mailhost=("smtp.example.com",25), fr