lighter weight options to Python's logging package?

skip at pobox.com skip at pobox.com
Fri Mar 10 18:38:10 EST 2006


    Trent> Do you have any profile information for where in the logging
    Trent> package the time is being spent?

Looking back at a recent run from a few days ago Formatter.formatTime()
seems to be a current problem.

We create our own LogRecord subclass.  Because that was such a heavyweight
operation, instead of calling logging.LogRecord.__init__ from our class's
constructor, I wound up inlining it and deleting the state it set that we
never used.

    Trent> I don't know how much of a perf issue it is for you. Perhaps
    Trent> tweaking your usage of the logging package (perhaps using custom
    Trent> Loggers, Filters, outputters, etc.)  could be made "good enough".

We've done a bit already.  I will see if there's more we can do.  Our use of
the package is actually very simple.  All we do are log basic messages.  Our
Formatter instance includes the time, level and message.  That's it.  We
have no need for displaying exception info, don't do threads, don't mess
with the file or module names, etc.  The only thing we do that isn't
supported directly by the package is to use a compressing version of the
RotatingFileHandler class.

Skip



More information about the Python-list mailing list