[issue20918] Logging of logging exceptions can fail in 3.4 if args are unprintable

2014-03-18 Thread the mulhern
the mulhern added the comment: Thanks for the fix. When you say having repr raise is a pretty unusual occurrence you probably mean having repr raise should be a pretty unusual occurrence. I think its more usual than you realize and the regression in 3.4 will have consequences. --

[issue20918] Logging of logging exceptions can fail in 3.4 if args are unprintable

2014-03-18 Thread R. David Murray
R. David Murray added the comment: Did you reopen the issue accidentally? The bug has been fixed. -- status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20918 ___

[issue20918] Logging of logging exceptions can fail in 3.4 if args are unprintable

2014-03-14 Thread R. David Murray
.__init__ should handle exception if % operation fails - Logging of logging exceptions can fail in 3.4 if args are unprintable versions: -Python 2.7, Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20918

[issue20918] Logging of logging exceptions can fail in 3.4 if args are unprintable

2014-03-14 Thread the mulhern
the mulhern added the comment: Yes, I really misinterpreted what I saw. So glad it's a bug anyway and I'm not just wasting your time ;) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20918

[issue20918] Logging of logging exceptions can fail in 3.4 if args are unprintable

2014-03-14 Thread Roundup Robot
Roundup Robot added the comment: New changeset 73c2a70e4b35 by Vinay Sajip in branch 'default': Closes #20918: Added handling for exceptions during fallback output of logging exceptions. http://hg.python.org/cpython/rev/73c2a70e4b35 -- nosy: +python-dev resolution: - fixed stage

[issue20918] Logging of logging exceptions can fail in 3.4 if args are unprintable

2014-03-14 Thread Vinay Sajip
Vinay Sajip added the comment: This fix doesn't seem to meet the criteria for cherry-picking for 3.4 - Only important interface changes, new features, or bugfixes should be checked in now - so I haven't created a separate cherry-pick issue for it. But I will add larry to nosy in case he

[issue20918] Logging of logging exceptions can fail in 3.4 if args are unprintable

2014-03-14 Thread R. David Murray
R. David Murray added the comment: At this point only things that would make it a brown bag release (broken out of the box) would get cherry picked. I agree that this doesn't qualify...having repr raise is a pretty unusual occurrence. -- ___

Re: Repeated output when logging exceptions

2009-09-30 Thread Chris Withers
Vinay Sajip wrote: I'm not sure why you need all the code you've posted. The logging package allows you to add tracebacks to your logs by using the exception() method, which logs an ERROR with a traceback and is specifically intended for use from within exception handlers. You can also use

Re: Repeated output when logging exceptions

2009-09-30 Thread Chris Withers
John Gordon wrote: If I didn't do all that in a class, where would I do it? I find the configureLoggers method of ZConfig most convenient for this: http://pypi.python.org/pypi/ZConfig cheers, Chris -- Simplistix - Content Management, Batch Processing Python Consulting -

Re: Repeated output when logging exceptions

2009-09-29 Thread Vinay Sajip
On Sep 28, 9:38 pm, John Gordon gor...@panix.com wrote: If I didn't do all that in a class, where would I do it? You could, for example, use the basicConfig() function to do it all for you. import logging logging.basicConfig(filename='/path/to/my/log',level=logging.DEBUG) logging.debug('This

Re: Repeated output when logging exceptions

2009-09-28 Thread John Gordon
in a constructor. If you write your applications without using the exceptionLogger class (not really needed, since logging exceptions with tracebacks is part and parcel of the logging package's functionality since its introduction with Python 2.3), what functionality do you lose? I'm trying

Re: Repeated output when logging exceptions

2009-09-28 Thread Simon Forman
are almost guaranteed to not avoid if you do this kind of processing in a constructor. If you write your applications without using the exceptionLogger class (not really needed, since logging exceptions with tracebacks is part and parcel of the logging package's functionality since its

Re: Repeated output when logging exceptions

2009-09-25 Thread Vinay Sajip
(not really needed, since logging exceptions with tracebacks is part and parcel of the logging package's functionality since its introduction with Python 2.3), what functionality do you lose? Regards, Vinay Sajip -- http://mail.python.org/mailman/listinfo/python-list

Repeated output when logging exceptions

2009-09-24 Thread John Gordon
I wrote some code to handle and log exceptions in my application. It works well, but it produces double output for each exception. How can I fix this? Here's the pared-down code: - main.py import exceptionLogger import doStuff exlog = exceptionLogger.exceptionLogger() stuff =

Re: Logging exceptions to a file

2009-05-07 Thread Lawrence D'Oliveiro
In message 597627b8- d30b-4b74-9202-9cd46fb1d...@s28g2000vbp.googlegroups.com, Pierre GM wrote: ... I'd like to record (possibly unhandled) exceptions in the logfile. python myscript.py 2error.log -- http://mail.python.org/mailman/listinfo/python-list

Re: Logging exceptions to a file

2009-05-07 Thread Lie Ryan
Pierre GM wrote: All, I need to log messages to both the console and a given file. I use the following code (on Python 2.5) import logging # logging.basicConfig(level=logging.DEBUG,) logfile = logging.FileHandler('log.log') logfile.setLevel(level=logging.INFO)

Re: Logging exceptions to a file

2009-05-07 Thread Pierre GM
On May 7, 5:32 am, Lie Ryan lie.1...@gmail.com wrote: Pierre GM wrote: All, I need to log messages to both the console and a given file. I use the following code (on Python 2.5) import logging # logging.basicConfig(level=logging.DEBUG,) logfile = logging.FileHandler('log.log')

Re: Logging exceptions to a file

2009-05-07 Thread Stephen Hansen
So far so good, but I'd like to record (possibly unhandled) exceptions in the logfile. * Do I need to explicitly trap every single exception ? * In that case, won't I get 2 log messages on the console (as illustrated in the code below: Check out sys.excepthook, something

Re: Logging exceptions to a file

2009-05-07 Thread segfaulthunter
On May 7, 1:19 pm, Pierre GM pierregmc...@gmail.com wrote: On May 7, 5:32 am, Lie Ryan lie.1...@gmail.com wrote: Pierre GM wrote: All, I need to log messages to both the console and a given file. I use the following code (on Python 2.5) import logging #

Logging exceptions to a file

2009-05-06 Thread Pierre GM
All, I need to log messages to both the console and a given file. I use the following code (on Python 2.5) import logging # logging.basicConfig(level=logging.DEBUG,) logfile = logging.FileHandler('log.log') logfile.setLevel(level=logging.INFO) logging.getLogger('').addHandler(logfile) #

Re: logging exceptions

2008-08-27 Thread Vinay Sajip
On Aug 26, 10:36 am, Alexandru Mosoi [EMAIL PROTECTED] wrote: why doesn'tloggingthrow any exception when it should? how do I configureloggingto throw exceptions? try: ... logging.fatal('asdf %d', '123') ... except: ... print 'this line is never printed' ... Traceback (most recent

Re: logging exceptions

2008-08-27 Thread Rob Wolfe
Vinay Sajip napisał(a): On Aug 26, 10:36 am, Alexandru Mosoi [EMAIL PROTECTED] wrote: why doesn'tloggingthrow any exception when it should? how do I configureloggingto throw exceptions? try: ... logging.fatal('asdf %d', '123') ... except: ... print 'this line is never

Re: logging exceptions

2008-08-27 Thread Vinay Sajip
On Aug 27, 10:30 am, Rob Wolfe [EMAIL PROTECTED] wrote: Vinay Sajip napisa³(a): On Aug 26, 10:36 am, Alexandru Mosoi [EMAIL PROTECTED] wrote: why doesn'tloggingthrow any exception when it should? how do I configureloggingto throw exceptions? try: ... logging.fatal('asdf %d',

logging exceptions

2008-08-26 Thread Alexandru Mosoi
why doesn't logging throw any exception when it should? how do I configure logging to throw exceptions? try: ... logging.fatal('asdf %d', '123') ... except: ... print 'this line is never printed' ... Traceback (most recent call last): File

Re: logging exceptions

2008-08-26 Thread Rob Wolfe
Alexandru Mosoi napisał(a): why doesn't logging throw any exception when it should? how do I configure logging to throw exceptions? try: ... logging.fatal('asdf %d', '123') ... except: ... print 'this line is never printed' ... [...] You need to subclass your handler and redefine

problem with logging exceptions with non-ASCII __str__ result

2008-01-14 Thread Karsten Hilbert
Dear all, I have a problem with logging an exception. environment: Python 2.4, Debian testing ${LANGUAGE} not set ${LC_ALL} not set ${LC_CTYPE} not set ${LANG}=de_DE.UTF-8 activating user-default locale with locale.setlocale(locale.LC_ALL, '')

Re: problem with logging exceptions with non-ASCII __str__ result

2008-01-14 Thread Vinay Sajip
On Jan 14, 5:46 pm, Karsten Hilbert [EMAIL PROTECTED] wrote: Dear all, I have a problem withloggingan exception. environment: Python 2.4, Debian testing ${LANGUAGE} not set ${LC_ALL} not set ${LC_CTYPE} not set ${LANG}=de_DE.UTF-8