A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://github.com/puentesarrin/mongodb-log/ below:

puentesarrin/mongodb-log: MongoDB Python logging handler, Centralized logging made simple using MongoDB.

MongoLog: Centralized logging made simple using MongoDB

Before using this handler for logging you will need to create a capped collection on the MongoDB server.

You can do this using the following commands in the MongoDB shell:

> use mongolog
> db.createCollection('log', {capped:true, size:100000})

... and you are ready. Running stats() function on log collection should show something like this:

> db.log.stats()
{
        "ns" : "mongolog.log",
        "count" : 0,
        "size" : 0,
        "storageSize" : 102400,
        "numExtents" : 1,
        "nindexes" : 1,
        "lastExtentSize" : 102400,
        "paddingFactor" : 1,
        "systemFlags" : 1,
        "userFlags" : 0,
        "totalIndexSize" : 8176,
        "indexSizes" : {
                "_id_" : 8176
        },
        "capped" : true,
        "max" : 2147483647,
        "ok" : 1
}
>>> import logging
>>> from mongolog.handlers import MongoHandler
>>>
>>> log = logging.getLogger('demo')
>>> log.setLevel(logging.DEBUG)
>>> log.addHandler(MongoHandler.to(db='mongolog', collection='log'))
>>>
>>> log.debug('Some message')

Check the samples folder for more details.

"MongoDB is a high-performance, open source, schema-free document-oriented database."

It can eficiently store arbitrary JSON objects. You can read more at MongoDB website.

Why MongoDB is great for logging?

Read more about this subject on the MongoDB blog.

Have fun!


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4