Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • MongoDbAppender - stores the LogEvent in a BSONified form
  • ExtendedMongoDbAppender - Extends MongoDbAppender by allowing you to add top level elements
  • MongoDbPatternLayoutAppender - supports logging data in a custom format

log4mongo-java on GitHub

QuickStart

...

  1. Download and install MongoDB
  2. Start mongod running on localhost on the default port
  3. Download the Mongo Java driver jarfile
  4. Download Log4J jarfile
  5. Download log4mongo-java jarfile
  6. Place these three jar files in your classpath
  7. Create a file called log4j.properties in your classpath
  8. Add the following lines to the log4j.properties file
    a. log4j.rootLogger=INFO, MongoDB
    b. log4j.appender.MongoDB=org.log4mongo.MongoDbAppender
    c. log4j.appender.MongoDB.databaseName=appname
    d. log4j.appender.MongoDB.collectionName=log
  9. Create a Java class like:

...