Home > monglogg

monglogg

Monglogg is a project mainly written in RUBY and JAVASCRIPT, based on the MIT license.

Rails logging with Mongo flavor

= monglögg - Rails logging with Mongo flavor

!!! Monglögg is still in development, it should not be used in ANY production environment (I highly doubt it would work)!!!

Monglögg is a simple Rails logging gem, especially useful when you host your application on more than one server. It allows you to connect all hosts to single MongoDB instance, to store there all application logs.

== Installing

It's as simple as adding

gem 'monglogg', :git => 'git://github.com/zgryw/monglogg.git'

to your Gemfile and... let the magic begin!

== Configuration

By default, Monglögg will try to connect to Mongo @ localhost:27017, but you can of course override this settings, with config/monglogg.yml, which syntax is similar to database.yml:

development: host: localhost port: 27017 db: monglogg

collection: testcollection (default: #{appname}#{environment}_log)

# username: root              (default: none)
# password: toor              (default: none)

== Usage

Monglögg uses LogSubscribers, to get all of your application Events stored in a MongoDB. Typical stored request object looks like this:

{ "_id" : ObjectId("4d28d67914a32e10a4000001"), "messages" : { }, "sql" : [ { "duration" : 5.040002, "sql" : "SELECT "items".* FROM "items" ORDER BY finished ASC", "name" : "Item Load" } ], "views" : [ { "duration" : 86.25397699999999, "view" : "items/index.html.haml", "layout" : "layouts/application" } ], "ip" : "192.168.1.2", "custom" : [ ], "controller" : "ItemsController", "action" : "index", "method" : "GET", "formats" : ["html"], "path" : "/", "params" : { "controller" : "items", "action" : "index" }, "time" : ISODate("2011-01-08T21:26:51.099Z"), "status" : 200, "view_runtime" : 92.36598014831543, "db_runtime" : 5.669828000000001 }

If you need to store some additional info about your request, you can use Monglogg::Logger#add_data like this:

Monglogg.logger.add_data(:some_really_important_data => "isn't it?")

== TODO

  • write tests that would actually matter
  • action_mailer & active_resource log subscribers
  • missing methods in action_controller log subscriber
  • test rendering template
  • create cache in case of mongo disconnect
  • handle mongo disconnects

== Copyright

Copyright (c) 2011 Łukasz Sągol. See LICENSE.txt for further details.

Previous:flags