Repeated output when logging exceptions

Vinay Sajip vinay_sajip at yahoo.co.uk
Tue Sep 29 08:53:35 CEST 2009


On Sep 28, 9:38 pm, John Gordon <gor... at 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 message should go to the log file')

Here's the documentation link for simple examples:

http://docs.python.org/library/logging.html#simple-examples

Here's the link for basicConfig:

http://docs.python.org/library/logging.html#logging.basicConfig

Regards,

Vinay Sajip



More information about the Python-list mailing list