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
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)
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')
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
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
#
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)
#