[stdlib-sig] logging

Vinay Sajip vinay_sajip at yahoo.co.uk
Fri Sep 18 18:10:56 CEST 2009


Paul Moore <p.f.moore at ...> writes:

> - The file configuration seems very complex, for simple uses. I looked
> at using it, but ultimately rolled my own, because I only wanted a few
> simple options (which, no surprise, grew as time went on ).
[snip]
> Oh, and finally I *hate* Java-style camelCase but that's purely a
> preference thing, and it's not going to change for compatibility
> reasons, so let's ignore that.

Okay, I've commented elsewhere that I'm happy to provide
unix_style_underscored_names.

> Anyway, ultimately have no significant issues with the logging module.
> Maybe it doesn't make the simple cases as simple as I'd like, but it
> gives me all the power I'm ever likely to need, and then some. So
> thanks for all your work on it!

For non-rotating files, it's really as simple as 

import logging

logging.basicConfig(filename='/tmp/logging_example.out',
                    level=logging.DEBUG,)
logging.debug('This message should go to the log file')

Of course for rotating it's more involved, but that's where there's
really not much of a common denominator. IMO The best approach would be
to add recipes to the Python Cookbook on ActiveState.




More information about the stdlib-sig mailing list