MongoVision + logmonger: goodness for MongoDb & Python logs

I’ve recently come across these two projects and, while each on its own is real goodness, when combined together they seem to be better than the sum of the parts.

MongoVision is a web front-end and visualization tool for MongoDB running on Prudence:

logmongerlogmonger is a Python library that writes log entries to a MongoDb database, so that they can be more easily searchable and can also be aggregated, etc.

With only two lines of code you can redirect your logs to a permanent store backed by MongoDb:

logger = logging.getLogger()

handler = logmonger.MongoHandler()
logger.addHandler(handler)
logger.setLevel(logging.INFO)

logger.error("There was an error")
logger.warning("This is a warning")
logger.info("All is well")

try:
    do_something_that_raises()
except Exception as e:
    logger.exception(e)

I will experiment with both more and plan to post findings and other tips.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s