org.apache.logging.log4j.nosql.appender
Class NoSqlAppender

java.lang.Object
  extended by org.apache.logging.log4j.core.AbstractLifeCycle
      extended by org.apache.logging.log4j.core.filter.AbstractFilterable
          extended by org.apache.logging.log4j.core.appender.AbstractAppender
              extended by org.apache.logging.log4j.core.appender.db.AbstractDatabaseAppender<NoSqlDatabaseManager<?>>
                  extended by org.apache.logging.log4j.nosql.appender.NoSqlAppender
All Implemented Interfaces:
Serializable, Appender, Filterable, LifeCycle

@Plugin(name="NoSql",
        category="Core",
        elementType="appender",
        printObject=true)
public final class NoSqlAppender
extends AbstractDatabaseAppender<NoSqlDatabaseManager<?>>

This Appender writes logging events to a NoSQL database using a configured NoSQL provider. It requires implementations of NoSqlObject, NoSqlConnection, and NoSqlProvider to "know" how to write events to the chosen NoSQL database. Two provider implementations are provided: MongoDB (org.mongodb:mongo-java-driver:2.11.1 or newer must be on the classpath) and Apache CouchDB (org.lightcouch:lightcouch:0.0.5 or newer must be on the classpath). For examples on how to write your own NoSQL provider, see the simple source code for the MongoDB and CouchDB providers.

See Also:
NoSqlObject, NoSqlConnection, NoSqlProvider, Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.apache.logging.log4j.core.LifeCycle
LifeCycle.State
 
Field Summary
 
Fields inherited from class org.apache.logging.log4j.core.AbstractLifeCycle
LOGGER
 
Method Summary
static NoSqlAppender createAppender(String name, String ignore, Filter filter, String bufferSize, NoSqlProvider<?> provider)
          Factory method for creating a NoSQL appender within the plugin manager.
 String toString()
           
 
Methods inherited from class org.apache.logging.log4j.core.appender.db.AbstractDatabaseAppender
append, getLayout, getManager, replaceManager, start, stop
 
Methods inherited from class org.apache.logging.log4j.core.appender.AbstractAppender
error, error, error, getHandler, getName, ignoreExceptions, parseInt, setHandler
 
Methods inherited from class org.apache.logging.log4j.core.filter.AbstractFilterable
addFilter, getFilter, hasFilter, isFiltered, removeFilter
 
Methods inherited from class org.apache.logging.log4j.core.AbstractLifeCycle
equalsImpl, getState, hashCodeImpl, isInitialized, isStarted, isStarting, isStopped, isStopping, setStarted, setStarting, setState, setStopped, setStopping
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.apache.logging.log4j.core.LifeCycle
getState, isStarted, isStopped
 

Method Detail

toString

public String toString()
Overrides:
toString in class AbstractAppender

createAppender

@PluginFactory
public static NoSqlAppender createAppender(@PluginAttribute(value="name")
                                                         String name,
                                                         @PluginAttribute(value="ignoreExceptions")
                                                         String ignore,
                                                         @PluginElement(value="Filter")
                                                         Filter filter,
                                                         @PluginAttribute(value="bufferSize")
                                                         String bufferSize,
                                                         @PluginElement(value="NoSqlProvider")
                                                         NoSqlProvider<?> provider)
Factory method for creating a NoSQL appender within the plugin manager.

Parameters:
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.
provider - The NoSQL provider that provides connections to the chosen NoSQL database.
Returns:
a new NoSQL appender.


Copyright © 1999-2015 Apache Software Foundation. All Rights Reserved.
Apache Logging, Apache Log4j, Log4j, Apache, the Apache feather logo, the Apache Logging project logo, and the Apache Log4j logo are trademarks of The Apache Software Foundation.