org.log4mongo
Class ExtendedMongoDbAppender
java.lang.Object
org.apache.log4j.AppenderSkeleton
org.log4mongo.BsonAppender
org.log4mongo.MongoDbAppender
org.log4mongo.ExtendedMongoDbAppender
- All Implemented Interfaces:
- org.apache.log4j.Appender, org.apache.log4j.spi.OptionHandler
public class ExtendedMongoDbAppender
- extends MongoDbAppender
This appender is designed so you can add top level elements to each logging
entry. Users can also extend MongoDbAppender themselves in order to add the
top level elements.
Use case: A desire to use a common appender for unified logs across different
code bases, such that commonly logged elements be consistent, such as
application, eventType, etc. This is enabled by adding a property called
rootLevelProperties with a key=value list of elements to be added to the root
level log. See log4j.properties.sample for an example.
- Author:
- Mick Knutson (http://www.baselogic.com)
| Fields inherited from class org.apache.log4j.AppenderSkeleton |
closed, errorHandler, headFilter, layout, name, tailFilter, threshold |
|
Method Summary |
void |
activateOptions()
|
void |
append(com.mongodb.DBObject bson)
Method implemented by a concrete class to store the BSON object. |
void |
initTopLevelProperties()
Initialize custom top level elements to appear in a log event |
void |
setRootLevelProperties(java.lang.String rootLevelProperties)
This will handle spaces and empty values
A = minus- & C=equals= & E==F
For XML, must escape (&) |
| Methods inherited from class org.log4mongo.MongoDbAppender |
close, getCollection, getCollectionName, getConcern, getDatabase, getDatabaseName, getHostname, getMongo, getPort, getUserName, getWriteConcern, isInitialized, requiresLayout, setCollection, setCollectionName, setDatabaseName, setHostname, setPassword, setPort, setUserName, setWriteConcern |
| Methods inherited from class org.apache.log4j.AppenderSkeleton |
addFilter, clearFilters, doAppend, finalize, getErrorHandler, getFilter, getFirstFilter, getLayout, getName, getThreshold, isAsSevereAsThreshold, setErrorHandler, setLayout, setName, setThreshold |
| Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ExtendedMongoDbAppender
public ExtendedMongoDbAppender()
activateOptions
public void activateOptions()
- Specified by:
activateOptions in interface org.apache.log4j.spi.OptionHandler- Overrides:
activateOptions in class MongoDbAppender
- See Also:
AppenderSkeleton.activateOptions()
initTopLevelProperties
public void initTopLevelProperties()
- Initialize custom top level elements to appear in a log event
Allows users to create custom properties to be added to the top level
log event.
setRootLevelProperties
public void setRootLevelProperties(java.lang.String rootLevelProperties)
- This will handle spaces and empty values
A = minus- & C=equals= & E==F
For XML, must escape (&)
- Parameters:
rootLevelProperties -
append
public void append(com.mongodb.DBObject bson)
- Description copied from class:
BsonAppender
- Method implemented by a concrete class to store the BSON object.
- Overrides:
append in class MongoDbAppender
- Parameters:
bson - The BSON object to insert into a MongoDB database collection.
Copyright © 2013. All Rights Reserved.