...
- 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
QuickStart
...
- Download and install MongoDB
- Start mongod running on localhost on the default port
- Download the Mongo Java driver jarfile
- Download Log4J jarfile
- Download log4mongo-java jarfile
- Place these three jar files in your classpath
- Create a file called log4j.properties in your classpath
- 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 - Create a Java class like:
...