@Plugin(name="MongoDB", category="Sincerity", elementType="appender", printObject=true) public class MongoDbAppender extends org.apache.logging.log4j.core.appender.db.AbstractDatabaseAppender<MongoDbManager>
Warning: Because the MongoDB driver itself emits log messages, you
might cause recursion here that would lead to hangs and timeouts. The easiest
solution is to simply disable its logging via your Log4j configuration: just
set the org.mongodb.driver
logger to level Level.OFF
.
org.apache.logging.log4j.core.LifeCycle.State
LOGGER
Modifier | Constructor and Description |
---|---|
protected |
MongoDbAppender(String name,
org.apache.logging.log4j.core.Filter filter,
boolean ignoreExceptions,
MongoDbManager manager) |
Modifier and Type | Method and Description |
---|---|
static MongoDbAppender |
createAppender(String name,
String ignore,
org.apache.logging.log4j.core.Filter filter,
String bufferSize,
String uri,
String db,
String collection,
String writeConcern)
Factory method for creating a MongoDB appender within the plugin manager.
|
String |
toString() |
append, getLayout, getManager, replaceManager, start, stop
error, error, error, getHandler, getName, ignoreExceptions, parseInt, setHandler
addFilter, getFilter, hasFilter, isFiltered, removeFilter
getState, isInitialized, isStarted, isStarting, isStopped, isStopping, setStarted, setStarting, setState, setStopped, setStopping
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
isStarted, isStopped
protected MongoDbAppender(String name, org.apache.logging.log4j.core.Filter filter, boolean ignoreExceptions, MongoDbManager manager)
@PluginFactory public static MongoDbAppender createAppender(@PluginAttribute(value="name") String name, @PluginAttribute(value="ignoreExceptions") String ignore, @PluginElement(value="Filter") org.apache.logging.log4j.core.Filter filter, @PluginAttribute(value="bufferSize") String bufferSize, @PluginAttribute(value="uri") String uri, @PluginAttribute(value="db") String db, @PluginAttribute(value="collection") String collection, @PluginAttribute(value="writeConcern") String writeConcern)
name
- The name of the appender.ignore
- If "true"
(default) exceptions encountered when appending
events are logged; otherwise they are propagated to the caller.filter
- The filter, if any, to use.bufferSize
- If an integer greater than 0, this causes the appender to buffer
log events and flush whenever the buffer reaches this size.uri
- The MongoDB URI (see MongoClientURI
)db
- The MongoDB database namecollection
- The MongoDB collection namewriteConcern
- The MongoDB write concern (see
WriteConcern.valueOf(String)
)public String toString()
toString
in class org.apache.logging.log4j.core.appender.AbstractAppender
Copyright © 2011-2016 Three Crickets LLC.