Skip to main content

A simple mongo based logger

Project description


MongoLog is a simple mongo based log handler that can be used easly used
with standard python/django logging

Quick start

1. Add "mongolog" to your INSTALLED_APPS setting like this::


2. Add the MongoLoggerHandler to your LOGGING config::

'handler': {
'mongologger': {
'level': 'WARN',
'class': 'mongolog.MongoLoggerHandler',
'connection': 'mongodb://localhost:27017/'
'loggers': {
'django': {
'handlers': ['console', 'mongologger'],
'level': 'DEBUG',
'propagate': True

3) Start you management shell::

./ shell

4) Create a a couple of log entries::

import logging
logger = logging.getLogger(__name__)

logger.debug("A debug message")"An info message")
logger.warning("A Serious warning")
logger.error("We have an ERROR")
raise ValueError("Bad Value")
except ValueError as e:
logger.exception("This is the worste exception ever")

5) Now log into your mongo shell::

> use mongologger
> db.mongologger.find().sort({created: -1}).limit(5).pretty()

If you setup your logger with level 'WARN' like the example then
you should now see three log entries corresponding to the warning,
error, and exception log statements. However, you will not see the
debug and info statements unless you adjust the level down to 'DEBUG'.

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 django-mongolog, version 0.1.6
Filename, size File type Python version Upload date Hashes
Filename, size django-mongolog-0.1.6.tar.gz (16.8 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page