Below is a list of links to handlers, filters, formatters and utilities which have been developed for use with the logging package in the Python standard library. You'll need to check for licensing terms and documentation at the particular sites linked to. These links are shown for information only and do not imply any specific endorsement: you'll need to do your own research to determine their suitability and applicability for your particular application.
Handlers
- Lowell Alleman has written a ConcurrentLogHandler which is a drop-in replacement for RotatingFileHandler, but allows concurrent access to the log file by multiple processes.
- Mike Bayer has written a rotating file handler which works with the multiprocessing module.
- David Cramer's django-sentry includes a SentryHandler class which sends logging messages to django-sentry.
- Vladimir Gorej has written log4mongo, which includes a MongoHandler and a MongoFormatter for logging to MongoDB databases.
- Kevin Howerton has written handlers for Arecibo, a database table via a Django model, and email to configured Django site administrators.
- Christopher Petrilli's py-amqp-logging includes an AMQPHandler class which sends logging messages to an AMQP broker.
- Min Ragan-Kelley has written a PUBHandler which publishes logging events on a ZeroMQ PUB (publish) socket. This code is part of pyzmq, the official Python wrapper for ZeroMQ.
- Willi Richert has written a JabberHandler for sending logging messages to a Jabber account.
- Armin Ronacher has written a TracHandler for sending logging messages to Trac, and also a TwitterHandler for sending logging messages to Twitter.
- This Stack Overflow answer shows an example DBHandler which demonstrates a database handler which uses the Python DB-API 2.0 to communicate with an RDBMS.
- This Stack Overflow answer shows an example WxTextCtrlHandler showing how to redirect log messages to a wxPython TextCtrl widget.
- Yohei Sasaki has also written a TweetHandler for sending logging messages to Twitter.
- Andrei Savu's mongodb-log includes a MongoHandler for sending logging messages to a MongoDB database. There's another MongoDB handler in the logmonger project by Jonas Ericsson.
- The Somethinkodd Development Team has written a NonBlockingLogHandler which does handling activities in the background.
- Chris Withers has written a MailingLogger which is an enhanced handler for sending emails.
- Mikael Jacobson describes using a handler to send events to phones via SMS.
- Jed Parsons describes a handler which uses Redis Pub/Sub to route logging events. There is a more recent, Python 3-supporting version available here.
- A test script from the original Python logging package shows how to implement a BufferingSMTPHandler, which sends multiple log events in a single email (the standard SMTPHandler sends one email per logging event).
- Sever Banesiu has written graypy, which includes a GELFHandler to allow logging to Graylog2 from Python applications.
- Jamie Begin has written a handler to send events to Amazon's SNS (Simple Notification Service) - SNSLogHandler.
- Lars Sjöström has written a FlumeHandler to send events to Apache Flume.
- Michiya Takahashi has written TableStorageHandler, QueueStorageHandler and BlobStorageTimedRotatingFileHandler to send events to Windows Azure Storage.
- Valérian Saliou has written a GitlabIssuesHandler to convert events to GitLab issues.
- The python-systemd project contains a JournalHandler to send logging events to the systemd journal.
- (Watch this space - I'll add more entries in due course)
Filters
- This Stack Overflow answer shows SingleLevelFilter, which can be used to redirect INFO-level messages to sys.stdout and other messages to sys.stderr.
Formatters
- This Stack Overflow answer by airmind shows a ColoredFormatter, which inserts escape codes to colorize console output.
- This Stack Overflow answer by Denis Otkidach shows a DispatchingFormatter, which can delegate to different formatters based on properties of the LogRecord.
Utilities
- Gabriel Genellina's LoggingWebMonitor listens for LogRecords sent from other processes running in the same box or network, collects and saves them concurrently in a log file. It shows a summary web page with the latest N records received.
- I've released a desktop log viewer (Qt-based) which allows capture and viewing of logging events - see this post.
- Brandon Rhodes has released a utility module, logging_tree, which introspects loggers and handlers.
- (Watch this space - I'll add more entries in due course)
If there are any other handlers or utilities which are not on the above list which you think should be added to the list, please post comments with links and a brief description of what's being linked to. Thanks.
This comment has been removed by a blog administrator.
ReplyDelete