Skip to content

Getting Started

rgnitz edited this page May 5, 2012 · 10 revisions

This is the quick-and-dirty guide to adding mongo-java-logging to your application. By default, the library uses the database "log" and the collection, "mongo-java-logging" - see the configuration doc for more information.

Standalone

  • Download the latest version of the library

  • Add the library to your [CLASSPATH](http://en.wikipedia.org/wiki/Classpath_(Java\))

  • Modify your logging.properties and add the following:

    • For the console and Mongo handler, add:

      handlers=java.util.logging.ConsoleHandler,com.deftlabs.logging.mongo.MongoHandler

    • If you only want a Mongo handler, use this:

      handlers=com.deftlabs.logging.mongo.MongoHandler

  • Add the MongoURI, which points at your instance of Mongo:

    com.deftlabs.logging.mongo.MongoHandler.mongoUri=mongodb://127.0.0.1:27017

Maven

<dependency>
    <groupId>com.deftlabs</groupId>
    <artifactId>mongo-java-logging</artifactId>
    <version>0.5.4</version>
</dependency>

Ivy

<dependency org="com.deftlabs" name="mongo-java-logging" rev="0.5.4" >
    <artifact name="mongo-java-logging" type="jar" />
</dependency>

Buildr

'com.deftlabs:mongo-java-logging:jar:0.5.4'

Grape

@Grapes( 
@Grab(group='com.deftlabs', module='mongo-java-logging', version='0.5.4') 
)

Clone this wiki locally