Skip to main content

Redis pub/sub logging handler for python

Project description

A logging handler for Python that publishes log messages using redis’s pub/sub system. You can use this to read or respond to streaming log data in real time.


The current stable release

easy_install python-redis-log

The latest from github

git clone git://
cd python-redis-log
python build
python install --prefix=$HOME  # for example



>>> from redislog import handlers, logger
>>> l = logger.RedisLogger('my.logger')
>>> l.addHandler("my:channel"))
>>>"I like pie")
>>> l.error("Trousers!", exc_info=True)

Redis clients subscribed to my:channel will get a json log record like the following (sent from function foo() in file

{ username: 'jed',
  args: [],
  name: 'my.logger',
  level: 'info',
  line_no: 6,
  traceback: null,
  filename: '',
  time: '2011-06-02T14:50:08.237052',
  msg: 'winning',
  funcname: 'foo',
  hostname: 'smoothie.local' }

If an exception is raised, and exc_info is True, the log will include a formatted traceback in traceback.

The date is stored as an ISO 8601 string in GMT.

You can use the redis-cli shell that comes with redis to test this. At the shell prompt, type subscribe my:channel (replacing with the channel name you choose, of course). You will see subsequent log data printed in the shell.

Serving Suggestion

Redis pub/sub messages are not persistent; they are just messages. So you will probably wish to use this handler in conjunction with other handlers that actually save your data, like the standard python FileHandlers, or Andrei Savu’s MongoDB logging handler.


Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for python-redis-log, version 0.1.2
Filename, size File type Python version Upload date Hashes
Filename, size python_redis_log-0.1.2-py2.6.egg (7.8 kB) File type Egg Python version 2.6 Upload date Hashes View
Filename, size python-redis-log-0.1.2.tar.gz (4.7 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page