Logy – a central logging system for Python

I’m glad to announce my new open source project:Logy. Logy is a simple lightweight central logging system for Python. When do you need a central logging system?  Well, when you have many servers online, and they are running different python application, you will want to have a central logging system for making sure everything is going fine.  And you might ask, why not just use email for error reports? Well, following screenshot explains:

I use email as error logging report, but however, as you can see if there is something wrong with my servers in same time, network outage for instance, there will be so many error report mails come in my mailbox like crazy.  Therefore think a central log might be a good idea, then I decide to develop a simple central logging system for my own servers.  Here is a screenshot of the Logy web page.

It categorizes your logging records by IP address automatically, and also, you can set a application name for different applications which are running in same box.  And one important feature is, it is base on Flask 🙂

It is super easy to write records to Logy, here is an example:

import logging

import ex_loghandlers

rootLogger = logging.getLogger('')
rootLogger.setLevel(logging.DEBUG)

sream_handler = logging.StreamHandler()
# set up the http handler which writes records to Logy server
http_handler = ex_loghandlers.ExHTTPHandler(host='localhost:5000',
                                            url='/sink/TEST/myapp',
                                            method='POST')
rootLogger.addHandler(sream_handler)
rootLogger.addHandler(http_handler)

logger1 = logging.getLogger('myapp.area1')
logger2 = logging.getLogger('myapp.area2')

logger1.debug('Quick zephyrs blow, vexing daft Jim.')
logger1.info('How quickly daft jumping zebras vex.')
logger2.warning('Jail zesty vixen who grabbed pay from quack.')
logger2.error('The five boxing wizards jump quickly.')

try:
    raise Exception("Boom")
except:
    logger1.fatal("Huston, we've got a problem", exc_info=True)

logger1.info('Everything goes fine, now.')

You need to install my module named ex_loghandlers before you can run this script, it contains an ExHTTPHandler which provides extra information for Logy.

Here are some more information of Logy:

PyPi page: http://pypi.python.org/pypi/logy

Bitbucket: https://bitbucket.org/victorlin/logy/src

This entry was posted in English Articles, 分享 and tagged , , . Bookmark the permalink.

One Response to Logy – a central logging system for Python

  1. Kate Smith says:

    It is certainly interesting for me to read this blog. Thanks for it. I like such topics and anything connected to this matter. I would like to read more soon.

    Kate Smith
    cim london escort