logging-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject svn commit: r1481025 - in /logging/log4j/log4j2/trunk: ./ core/ core/src/main/java/org/apache/logging/log4j/core/appender/ core/src/main/java/org/apache/logging/log4j/core/config/ core/src/main/java/org/apache/logging/log4j/core/layout/ core/src/site/x...
Date Fri, 10 May 2013 14:29:55 GMT
Author: ggregory
Date: Fri May 10 14:29:54 2013
New Revision: 1481025

URL: http://svn.apache.org/r1481025
Log:
[LOG4J2-229] New JDBC, JPA, and NoSQL database Appenders. First commit based on the patch by Nick Williams.

Modified:
    logging/log4j/log4j2/trunk/checkstyle.xml
    logging/log4j/log4j2/trunk/core/pom.xml
    logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/ConsoleAppender.java
    logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/FastFileAppender.java
    logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/FastRollingFileAppender.java
    logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/FileAppender.java
    logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/RollingFileAppender.java
    logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/config/BaseConfiguration.java
    logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/config/DefaultConfiguration.java
    logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/layout/PatternLayout.java
    logging/log4j/log4j2/trunk/core/src/site/xdoc/index.xml
    logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/ConsoleAppenderTest.java
    logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/FileAppenderTest.java
    logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/OutputStreamAppenderTest.java
    logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/layout/PatternLayoutTest.java
    logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/net/AbstractSocketServerTest.java
    logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/net/JMSQueueTest.java
    logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/net/JMSTopicTest.java
    logging/log4j/log4j2/trunk/log4j12-api/src/test/java/org/apache/log4j/CategoryTest.java
    logging/log4j/log4j2/trunk/log4j12-api/src/test/java/org/apache/log4j/LoggerTest.java
    logging/log4j/log4j2/trunk/pom.xml
    logging/log4j/log4j2/trunk/src/changes/changes.xml
    logging/log4j/log4j2/trunk/src/site/site.vm
    logging/log4j/log4j2/trunk/src/site/site.xml
    logging/log4j/log4j2/trunk/src/site/xdoc/manual/appenders.xml

Modified: logging/log4j/log4j2/trunk/checkstyle.xml
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/checkstyle.xml?rev=1481025&r1=1481024&r2=1481025&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/checkstyle.xml (original)
+++ logging/log4j/log4j2/trunk/checkstyle.xml Fri May 10 14:29:54 2013
@@ -1,4 +1,4 @@
-<?xml version="1.0"?>
+<?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE module PUBLIC
     "-//Puppy Crawl//DTD Check Configuration 1.1//EN"
     "http://www.puppycrawl.com/dtds/configuration_1_1.dtd">
@@ -118,6 +118,10 @@
         <module name="IllegalImport"/> <!-- defaults to sun.* packages -->
         <module name="RedundantImport"/>
         <module name="UnusedImports"/>
+        <module name="ImportControl">
+          <property name="severity" value="error"/>
+          <property name="file" value="checkstyle-import-control.xml"/>
+        </module>
 
 
         <!-- Checks for Size Violations.                    -->

Modified: logging/log4j/log4j2/trunk/core/pom.xml
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/pom.xml?rev=1481025&r1=1481024&r2=1481025&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/pom.xml (original)
+++ logging/log4j/log4j2/trunk/core/pom.xml Fri May 10 14:29:54 2013
@@ -23,7 +23,6 @@
     <version>2.0-beta7-SNAPSHOT</version>
     <relativePath>../</relativePath>
   </parent>
-  <groupId>org.apache.logging.log4j</groupId>
   <artifactId>log4j-core</artifactId>
   <packaging>jar</packaging>
   <name>Apache Log4J Core</name>
@@ -96,6 +95,21 @@
       <scope>test</scope>
     </dependency>
     <dependency>
+      <groupId>org.easymock</groupId>
+      <artifactId>easymock</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.hsqldb</groupId>
+      <artifactId>hsqldb</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.hibernate</groupId>
+      <artifactId>hibernate-entitymanager</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
       <groupId>org.mockejb</groupId>
       <artifactId>mockejb</artifactId>
       <scope>test</scope>
@@ -120,6 +134,24 @@
       <artifactId>mail</artifactId>
       <optional>true</optional>
     </dependency>
+    <dependency>
+      <groupId>org.hibernate.javax.persistence</groupId>
+      <artifactId>hibernate-jpa-2.0-api</artifactId>
+      <scope>compile</scope>
+      <optional>true</optional>
+    </dependency>
+    <dependency>
+      <groupId>org.mongodb</groupId>
+      <artifactId>mongo-java-driver</artifactId>
+      <scope>compile</scope>
+      <optional>true</optional>
+    </dependency>
+    <dependency>
+      <groupId>org.lightcouch</groupId>
+      <artifactId>lightcouch</artifactId>
+      <scope>compile</scope>
+      <optional>true</optional>
+    </dependency>
   </dependencies>
   <build>
     <plugins>

Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/ConsoleAppender.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/ConsoleAppender.java?rev=1481025&r1=1481024&r2=1481025&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/ConsoleAppender.java (original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/ConsoleAppender.java Fri May 10 14:29:54 2013
@@ -87,7 +87,7 @@ public final class ConsoleAppender<T ext
         }
         if (layout == null) {
             @SuppressWarnings({"unchecked", "UnnecessaryLocalVariable"})
-            Layout<S> l = (Layout<S>)PatternLayout.createLayout(null, null, null, null);
+            Layout<S> l = (Layout<S>)PatternLayout.createLayout(null, null, null, null, null);
             layout = l;
         }
         final boolean isFollow = follow == null ? false : Boolean.valueOf(follow);

Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/FastFileAppender.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/FastFileAppender.java?rev=1481025&r1=1481024&r2=1481025&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/FastFileAppender.java (original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/FastFileAppender.java Fri May 10 14:29:54 2013
@@ -155,7 +155,7 @@ public final class FastFileAppender<T ex
         }
         if (layout == null) {
             @SuppressWarnings({"unchecked", "UnnecessaryLocalVariable"})
-            Layout<S> l = (Layout<S>)PatternLayout.createLayout(null, null, null, null);
+            Layout<S> l = (Layout<S>)PatternLayout.createLayout(null, null, null, null, null);
             layout = l;
         }
         return new FastFileAppender<S>(name, layout, filter, manager, fileName,

Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/FastRollingFileAppender.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/FastRollingFileAppender.java?rev=1481025&r1=1481024&r2=1481025&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/FastRollingFileAppender.java (original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/FastRollingFileAppender.java Fri May 10 14:29:54 2013
@@ -199,7 +199,7 @@ public final class FastRollingFileAppend
 
         if (layout == null) {
             @SuppressWarnings({"unchecked", "UnnecessaryLocalVariable"})
-            Layout<S> l = (Layout<S>)PatternLayout.createLayout(null, null, null, null);
+            Layout<S> l = (Layout<S>)PatternLayout.createLayout(null, null, null, null, null);
             layout = l;
         }
 

Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/FileAppender.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/FileAppender.java?rev=1481025&r1=1481024&r2=1481025&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/FileAppender.java (original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/FileAppender.java Fri May 10 14:29:54 2013
@@ -136,7 +136,7 @@ public final class FileAppender<T extend
         }
         if (layout == null) {
             @SuppressWarnings({"unchecked", "UnnecessaryLocalVariable"})
-            Layout<S> l = (Layout<S>)PatternLayout.createLayout(null, null, null, null);
+            Layout<S> l = (Layout<S>)PatternLayout.createLayout(null, null, null, null, null);
             layout = l;
         }
 

Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/RollingFileAppender.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/RollingFileAppender.java?rev=1481025&r1=1481024&r2=1481025&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/RollingFileAppender.java (original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/RollingFileAppender.java Fri May 10 14:29:54 2013
@@ -174,7 +174,7 @@ public final class RollingFileAppender<T
 
         if (layout == null) {
             @SuppressWarnings({"unchecked", "UnnecessaryLocalVariable"})
-            Layout<S> l = (Layout<S>)PatternLayout.createLayout(null, null, null, null);
+            Layout<S> l = (Layout<S>)PatternLayout.createLayout(null, null, null, null, null);
             layout = l;
         }
 

Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/config/BaseConfiguration.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/config/BaseConfiguration.java?rev=1481025&r1=1481024&r2=1481025&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/config/BaseConfiguration.java (original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/config/BaseConfiguration.java Fri May 10 14:29:54 2013
@@ -231,7 +231,7 @@ public class BaseConfiguration extends A
         setName(DefaultConfiguration.DEFAULT_NAME);
         final Layout<? extends Serializable> layout =
                 PatternLayout.createLayout("%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n",
-                        null, null, null);
+                        null, null, null, null);
         final Appender<?> appender = ConsoleAppender.createAppender(layout, null, "SYSTEM_OUT", "Console", "false",
             "true");
         appender.start();

Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/config/DefaultConfiguration.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/config/DefaultConfiguration.java?rev=1481025&r1=1481024&r2=1481025&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/config/DefaultConfiguration.java (original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/config/DefaultConfiguration.java Fri May 10 14:29:54 2013
@@ -49,7 +49,7 @@ public class DefaultConfiguration extend
 
         setName(DEFAULT_NAME);
         final Layout<? extends Serializable> layout =
-                PatternLayout.createLayout("%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n", null, null, null);
+                PatternLayout.createLayout("%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n", null, null, null, null);
         final Appender<? extends Serializable> appender =
                 ConsoleAppender.createAppender(layout, null, "SYSTEM_OUT", "Console", "false", "true");
         appender.start();

Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/layout/PatternLayout.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/layout/PatternLayout.java?rev=1481025&r1=1481024&r2=1481025&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/layout/PatternLayout.java (original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/layout/PatternLayout.java Fri May 10 14:29:54 2013
@@ -16,8 +16,6 @@
  */
 package org.apache.logging.log4j.core.layout;
 
-import java.util.HashMap;
-import java.util.Map;
 import org.apache.logging.log4j.core.LogEvent;
 import org.apache.logging.log4j.core.config.Configuration;
 import org.apache.logging.log4j.core.config.plugins.Plugin;
@@ -33,7 +31,9 @@ import org.apache.logging.log4j.core.pat
 import org.apache.logging.log4j.core.pattern.RegexReplacement;
 
 import java.nio.charset.Charset;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 /**
  * <p>A flexible layout configurable with pattern string. The goal of this class
@@ -92,6 +92,8 @@ public final class PatternLayout extends
 
     private final RegexReplacement replace;
 
+    private final boolean handleExceptions;
+
     /**
      * Constructs a EnhancedPatternLayout using the supplied conversion pattern.
      *
@@ -99,15 +101,18 @@ public final class PatternLayout extends
      * @param replace The regular expression to match.
      * @param pattern conversion pattern.
      * @param charset The character set.
+     * @param handleExceptions Whether or not exceptions should always be handled in this pattern (if {@code true},
+     *                         exceptions will be written even if the pattern does not specify so).
      */
     private PatternLayout(final Configuration config, final RegexReplacement replace, final String pattern,
-                         final Charset charset) {
+                          final Charset charset, boolean handleExceptions) {
         super(charset);
         this.replace = replace;
         this.conversionPattern = pattern;
         this.config = config;
+        this.handleExceptions = handleExceptions;
         final PatternParser parser = createPatternParser(config);
-        formatters = parser.parse(pattern == null ? DEFAULT_CONVERSION_PATTERN : pattern, true);
+        formatters = parser.parse(pattern == null ? DEFAULT_CONVERSION_PATTERN : pattern, this.handleExceptions);
     }
 
     /**
@@ -123,7 +128,7 @@ public final class PatternLayout extends
             return;
         }
         final PatternParser parser = createPatternParser(this.config);
-        formatters = parser.parse(pattern);
+        formatters = parser.parse(pattern, this.handleExceptions);
     }
 
     public String getConversionPattern() {
@@ -190,18 +195,24 @@ public final class PatternLayout extends
 
     /**
      * Create a pattern layout.
+     *
      * @param pattern The pattern. If not specified, defaults to DEFAULT_CONVERSION_PATTERN.
      * @param config The Configuration. Some Converters require access to the Interpolator.
      * @param replace A Regex replacement String.
      * @param charsetName The character set.
+     * @param suppressExceptions Whether or not exceptions should be suppressed in this pattern (defaults to no, which
+     *                           means exceptions will be written even if the pattern does not specify so).
      * @return The PatternLayout.
      */
     @PluginFactory
     public static PatternLayout createLayout(@PluginAttr("pattern") final String pattern,
                                              @PluginConfiguration final Configuration config,
                                              @PluginElement("replace") final RegexReplacement replace,
-                                             @PluginAttr("charset") final String charsetName) {
+                                             @PluginAttr("charset") final String charsetName,
+                                             @PluginAttr("suppressExceptions") final String suppressExceptions) {
         final Charset charset = Charsets.getSupportedCharset(charsetName);
-        return new PatternLayout(config, replace, pattern == null ? DEFAULT_CONVERSION_PATTERN : pattern, charset);
+        boolean handleExceptions = suppressExceptions == null || !Boolean.parseBoolean(suppressExceptions);
+        return new PatternLayout(config, replace, pattern == null ? DEFAULT_CONVERSION_PATTERN : pattern, charset,
+                handleExceptions);
     }
 }

Modified: logging/log4j/log4j2/trunk/core/src/site/xdoc/index.xml
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/site/xdoc/index.xml?rev=1481025&r1=1481024&r2=1481025&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/site/xdoc/index.xml (original)
+++ logging/log4j/log4j2/trunk/core/src/site/xdoc/index.xml Fri May 10 14:29:54 2013
@@ -26,29 +26,33 @@
         <section name="Log4j 2 Implementation">
 
             <p>
-              The Log4Jj 2 implementation provides the functional components 
-              of the logging system. 
-              Users are free to create their own plugins and include them 
-              in the logging configuration.
+              The Log4Jj 2 implementation provides the functional components of the logging system.
+              Users are free to create their own plugins and include them in the logging configuration.
             </p>
 
         </section>
 
         <section name="Requirements">
-           <p>
-             Log4j 2 requires Java 6.
-             Some features may require optional 
-             <a href="dependencies.html">dependencies</a>. These dependencies are
-             specified in the documentation for those features.
-          </p>
-          <ul>
-          <li>JSON configuration requires the Jackson JSON-processor.</li>
-          <li>Async Loggers require the LMAX Disruptor.</li>
-          <li>SMTPAppender requires Javax Mail.</li>
-          <li>JMSQueueAppender and JMSTopicAppender require a JMS implementation like  
-             <a href="http://activemq.apache.org/">Apache ActiveMQ</a>.</li>
-          <li>Windows color support requires Jansi.</li>
-          </ul>
+            <p>
+                Log4j 2 requires Java 6. Some features may require optional
+                <a href="dependencies.html">dependencies</a>. These dependencies are specified in the
+                documentation for those features.
+            </p>
+            <ul>
+                <li>JSON configuration requires the Jackson JSON-processor.</li>
+                <li>Async Loggers require the LMAX Disruptor.</li>
+                <li>SMTPAppender requires Javax Mail.</li>
+                <li>JMSQueueAppender and JMSTopicAppender require a JMS implementation like
+                <a href="http://activemq.apache.org/">Apache ActiveMQ</a>.</li>
+                <li>Windows color support requires Jansi.</li>
+                <li>The JDBC Appender requires a JDBC driver for the database you choese to write events to.</li>
+                <li>The JPA Appender requires the Java Persistence API classes, a JPA provider implementation,
+                and a decorated entity that the user implements. It also requires an appropriate JDBC driver.</li>
+                <li>The NoSQL Appender with MongoDB provider requires the MongoDB Java Client driver.</li>
+                <li>The NoSQL Appender with Apache CouchDB provider requires the LightCouch CouchDB client library.</li>
+                <li>The NoSQL Appender can be customized with a user-supplied provider, which will require the
+                appropriate client library.</li>
+            </ul>
         </section>
 
     </body>

Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/ConsoleAppenderTest.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/ConsoleAppenderTest.java?rev=1481025&r1=1481024&r2=1481025&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/ConsoleAppenderTest.java (original)
+++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/ConsoleAppenderTest.java Fri May 10 14:29:54 2013
@@ -51,7 +51,7 @@ public class ConsoleAppenderTest {
     @Test
     public void testFollow() {
         final PrintStream ps = System.out;
-        final Layout<String> layout = PatternLayout.createLayout(null, null, null, null);
+        final Layout<String> layout = PatternLayout.createLayout(null, null, null, null, null);
         final ConsoleAppender<String> app = ConsoleAppender.createAppender(layout, null, "SYSTEM_OUT", "Console", "true", "false");
         app.start();
         final LogEvent event = new Log4jLogEvent("TestLogger", null, ConsoleAppenderTest.class.getName(), Level.INFO,

Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/FileAppenderTest.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/FileAppenderTest.java?rev=1481025&r1=1481024&r2=1481025&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/FileAppenderTest.java (original)
+++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/FileAppenderTest.java Fri May 10 14:29:54 2013
@@ -137,7 +137,7 @@ public class FileAppenderTest {
     }
 
     private static void writer(final boolean lock, final int count, final String name) throws Exception {
-        final Layout<String> layout = PatternLayout.createLayout(PatternLayout.SIMPLE_CONVERSION_PATTERN, null, null, null);
+        final Layout<String> layout = PatternLayout.createLayout(PatternLayout.SIMPLE_CONVERSION_PATTERN, null, null, null, null);
         final FileAppender<String> app = FileAppender.createAppender(FILENAME, "true", Boolean.toString(lock), "test", "false",
             "false", "false", layout, null, "false", null, null);
         final Thread t = Thread.currentThread();

Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/OutputStreamAppenderTest.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/OutputStreamAppenderTest.java?rev=1481025&r1=1481024&r2=1481025&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/OutputStreamAppenderTest.java (original)
+++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/OutputStreamAppenderTest.java Fri May 10 14:29:54 2013
@@ -37,7 +37,7 @@ public class OutputStreamAppenderTest {
 
     @Test
     public void testAppender() {
-        final Layout<String> layout = PatternLayout.createLayout(null, null, null, null);
+        final Layout<String> layout = PatternLayout.createLayout(null, null, null, null, null);
         final InMemoryAppender<String> app = new InMemoryAppender<String>("test", layout, null, false);
         final LogEvent event = new Log4jLogEvent("TestLogger", null, OutputStreamAppenderTest.class.getName(), Level.INFO,
             new SimpleMessage("Test"), null);

Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/layout/PatternLayoutTest.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/layout/PatternLayoutTest.java?rev=1481025&r1=1481024&r2=1481025&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/layout/PatternLayoutTest.java (original)
+++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/layout/PatternLayoutTest.java Fri May 10 14:29:54 2013
@@ -74,7 +74,7 @@ public class PatternLayoutTest {
         final String mdcMsgPattern5 = "%m : %X{key1},%X{key2},%X{key3}%n";
 
         // set up appender
-        final PatternLayout layout = PatternLayout.createLayout(msgPattern, ctx.getConfiguration(), null, null);
+        final PatternLayout layout = PatternLayout.createLayout(msgPattern, ctx.getConfiguration(), null, null, null);
         //FileOutputStream fos = new FileOutputStream(OUTPUT_FILE + "_mdc");
         final FileAppender appender = FileAppender.createAppender(OUTPUT_FILE + "_mdc", "false", "false", "File", "false",
             "true", "false", layout, null, "false", null, null);
@@ -137,7 +137,7 @@ public class PatternLayoutTest {
     public void testRegex() throws Exception {
         final LoggerContext ctx = (LoggerContext) LogManager.getContext();
         final PatternLayout layout = PatternLayout.createLayout(regexPattern, ctx.getConfiguration(),
-            null, null);
+            null, null, null);
         final LogEvent event = new Log4jLogEvent(this.getClass().getName(), null, "org.apache.logging.log4j.core.Logger",
             Level.INFO, new SimpleMessage("Hello, world!"), null);
         final byte[] result = layout.toByteArray(event);

Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/net/AbstractSocketServerTest.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/net/AbstractSocketServerTest.java?rev=1481025&r1=1481024&r2=1481025&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/net/AbstractSocketServerTest.java (original)
+++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/net/AbstractSocketServerTest.java Fri May 10 14:29:54 2013
@@ -98,7 +98,7 @@ public abstract class AbstractSocketServ
         appender.start();
         final ListAppender<LogEvent> listApp = new ListAppender<LogEvent>("Events", serverFilter, null, false, false);
         listApp.start();
-        final PatternLayout layout = PatternLayout.createLayout("%m %ex%n", null, null, null);
+        final PatternLayout layout = PatternLayout.createLayout("%m %ex%n", null, null, null, null);
         final ConsoleAppender<String> console = ConsoleAppender.createAppender(layout, null, "SYSTEM_OUT", "Console", "false", "true");
         final Logger serverLogger = ctx.getLogger(SocketServer.class.getName());
         serverLogger.addAppender(console);

Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/net/JMSQueueTest.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/net/JMSQueueTest.java?rev=1481025&r1=1481024&r2=1481025&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/net/JMSQueueTest.java (original)
+++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/net/JMSQueueTest.java Fri May 10 14:29:54 2013
@@ -102,7 +102,7 @@ public class JMSQueueTest {
         final CompositeFilter serverFilters = CompositeFilter.createFilters(new Filter[]{serverFilter});
         final ListAppender<LogEvent> listApp = new ListAppender<LogEvent>("Events", serverFilters, null, false, false);
         listApp.start();
-        final PatternLayout layout = PatternLayout.createLayout("%m %ex%n", null, null, null);
+        final PatternLayout layout = PatternLayout.createLayout("%m %ex%n", null, null, null, null);
         final ConsoleAppender console = ConsoleAppender.createAppender(layout, null, "SYSTEM_OUT", "Console", "false", "true");
         console.start();
         final Logger serverLogger = ctx.getLogger(JMSTopicReceiver.class.getName());

Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/net/JMSTopicTest.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/net/JMSTopicTest.java?rev=1481025&r1=1481024&r2=1481025&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/net/JMSTopicTest.java (original)
+++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/net/JMSTopicTest.java Fri May 10 14:29:54 2013
@@ -103,7 +103,7 @@ public class JMSTopicTest {
         final CompositeFilter serverFilters = CompositeFilter.createFilters(new Filter[]{serverFilter});
         final ListAppender<Serializable> listApp = new ListAppender<Serializable>("Events", serverFilters, null, false, false);
         listApp.start();
-        final PatternLayout layout = PatternLayout.createLayout("%m %ex%n", null, null, null);
+        final PatternLayout layout = PatternLayout.createLayout("%m %ex%n", null, null, null, null);
         final ConsoleAppender<? extends Serializable> console =
                 ConsoleAppender.createAppender(layout, null, "SYSTEM_OUT", "Console", "false", "true");
         console.start();

Modified: logging/log4j/log4j2/trunk/log4j12-api/src/test/java/org/apache/log4j/CategoryTest.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j12-api/src/test/java/org/apache/log4j/CategoryTest.java?rev=1481025&r1=1481024&r2=1481025&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/log4j12-api/src/test/java/org/apache/log4j/CategoryTest.java (original)
+++ logging/log4j/log4j2/trunk/log4j12-api/src/test/java/org/apache/log4j/CategoryTest.java Fri May 10 14:29:54 2013
@@ -161,7 +161,7 @@ public class CategoryTest {
     @Test
     public void testClassName() {
         final Category category = Category.getInstance("TestCategory");
-        final Layout<String> layout = PatternLayout.createLayout("%d %p %C{1.} [%t] %m%n", null, null, null);
+        final Layout<String> layout = PatternLayout.createLayout("%d %p %C{1.} [%t] %m%n", null, null, null, null);
         final ListAppender<String> appender = new ListAppender<String>("List2", null, layout, false, false);
         appender.start();
         category.setAdditivity(false);

Modified: logging/log4j/log4j2/trunk/log4j12-api/src/test/java/org/apache/log4j/LoggerTest.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j12-api/src/test/java/org/apache/log4j/LoggerTest.java?rev=1481025&r1=1481024&r2=1481025&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/log4j12-api/src/test/java/org/apache/log4j/LoggerTest.java (original)
+++ logging/log4j/log4j2/trunk/log4j12-api/src/test/java/org/apache/log4j/LoggerTest.java Fri May 10 14:29:54 2013
@@ -457,7 +457,7 @@ public class LoggerTest {
     @Test
     @SuppressWarnings("deprecation")
     public void testLog() {
-        final PatternLayout layout = PatternLayout.createLayout("%d %C %L %m", null, null, null);
+        final PatternLayout layout = PatternLayout.createLayout("%d %C %L %m", null, null, null, null);
         final ListAppender<String> appender = new ListAppender<String>("List", null, layout, false, false);
         appender.start();
         final Logger root = Logger.getRootLogger();

Modified: logging/log4j/log4j2/trunk/pom.xml
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/pom.xml?rev=1481025&r1=1481024&r2=1481025&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/pom.xml (original)
+++ logging/log4j/log4j2/trunk/pom.xml Fri May 10 14:29:54 2013
@@ -289,6 +289,36 @@
         <version>4.7</version>
         <scope>test</scope>
       </dependency>
+      <dependency>
+        <groupId>org.easymock</groupId>
+        <artifactId>easymock</artifactId>
+        <version>3.1</version>
+      </dependency>
+      <dependency>
+        <groupId>org.hsqldb</groupId>
+        <artifactId>hsqldb</artifactId>
+        <version>2.2.9</version>
+      </dependency>
+      <dependency>
+        <groupId>org.hibernate</groupId>
+        <artifactId>hibernate-entitymanager</artifactId>
+        <version>4.1.9.Final</version>
+      </dependency>
+      <dependency>
+        <groupId>org.hibernate.javax.persistence</groupId>
+        <artifactId>hibernate-jpa-2.0-api</artifactId>
+        <version>1.0.1.Final</version>
+      </dependency>
+      <dependency>
+        <groupId>org.mongodb</groupId>
+        <artifactId>mongo-java-driver</artifactId>
+        <version>2.11.1</version>
+      </dependency>
+      <dependency>
+        <groupId>org.lightcouch</groupId>
+        <artifactId>lightcouch</artifactId>
+        <version>0.0.5</version>
+      </dependency>
     </dependencies>
   </dependencyManagement>
   <build>

Modified: logging/log4j/log4j2/trunk/src/changes/changes.xml
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/src/changes/changes.xml?rev=1481025&r1=1481024&r2=1481025&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/src/changes/changes.xml (original)
+++ logging/log4j/log4j2/trunk/src/changes/changes.xml Fri May 10 14:29:54 2013
@@ -22,6 +22,9 @@
   </properties>
   <body>
     <release version="2.0-beta7" date="2013-??-??" description="Bug fixes and enhancements">
+      <action issue="LOG4J2-229" dev="ggregory" type="add" due-to="beamerblvd">
+        New JDBC, JPA, and NoSQL database Appenders.
+      </action>
       <action issue="LOG4J2-247" dev="ggregory" type="fix">
         SocketServer.isActive should be volatile because it is accessed from different threads.
       </action>

Modified: logging/log4j/log4j2/trunk/src/site/site.vm
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/src/site/site.vm?rev=1481025&r1=1481024&r2=1481025&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/src/site/site.vm (original)
+++ logging/log4j/log4j2/trunk/src/site/site.vm Fri May 10 14:29:54 2013
@@ -1,4 +1,20 @@
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+-->
 <!-- Generated by Apache Maven Doxia at $dateFormat.format( $currentDate ) -->
 #macro ( link $href $name $target $img $position $alt $border $width $height )
 	#set ( $linkTitle = ' title="' + $name + '"' )

Modified: logging/log4j/log4j2/trunk/src/site/site.xml
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/src/site/site.xml?rev=1481025&r1=1481024&r2=1481025&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/src/site/site.xml (original)
+++ logging/log4j/log4j2/trunk/src/site/site.xml Fri May 10 14:29:54 2013
@@ -74,8 +74,11 @@
         <item name="Failover" href="/manual/appenders.html#FailoverAppender"/>
         <item name="File" href="/manual/appenders.html#FileAppender"/>
         <item name="Flume" href="/manual/appenders.html#FlumeAppender"/>
+        <item name="JDBC" href="/manual/appenders.html#JDBCAppender"/>
         <item name="JMSQueue" href="/manual/appenders.html#JMSQueueAppender"/>
         <item name="JMSTopic" href="/manual/appenders.html#JMSTopicAppender"/>
+        <item name="JPA" href="/manual/appenders.html#JPAAppender"/>
+        <item name="NoSQL" href="/manual/appenders.html#NoSQLAppender"/>
         <item name="OutputStream" href="/manual/appenders.html#OutputStreamAppender"/>
         <item name="Rewrite" href="/manual/appenders.html#RewriteAppender"/>
         <item name="RollingFile" href="/manual/appenders.html#RollingFileAppender"/>

Modified: logging/log4j/log4j2/trunk/src/site/xdoc/manual/appenders.xml
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/src/site/xdoc/manual/appenders.xml?rev=1481025&r1=1481024&r2=1481025&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/src/site/xdoc/manual/appenders.xml (original)
+++ logging/log4j/log4j2/trunk/src/site/xdoc/manual/appenders.xml Fri May 10 14:29:54 2013
@@ -20,6 +20,7 @@
     <properties>
         <title>Log4j 2 Appenders</title>
         <author email="rgoers@apache.org">Ralph Goers</author>
+        <author email="nicholas@nicholaswilliams.net">Nick Williams</author>
     </properties>
 
     <body>
@@ -644,6 +645,118 @@
   </loggers>
 </configuration>]]></pre>
         </subsection>
+        <a name="JDBCAppender"/>
+        <subsection name="JDBCAppender">
+          <p>The JDBCAppender writes log events to a relational database table using standard JDBC. It can be configured
+          to obtain JDBC connections using the DriverManager, a JNDI DataSource or a custom factory method.</p>
+          <table>
+            <tr>
+              <th>Parameter Name</th>
+              <th>Type</th>
+              <th>Description</th>
+            </tr>
+            <tr>
+              <td>name</td>
+              <td>String</td>
+              <td>The name of the Appender.</td>
+            </tr>
+            <tr>
+              <td>suppressExceptions</td>
+              <td>boolean</td>
+              <td>The default is true, causing exceptions to be internally logged and then ignored. When set to false
+                exceptions will be percolated to the caller.</td>
+            </tr>
+            <tr>
+              <td>filter</td>
+              <td>Filter</td>
+              <td>A Filter to determine if the event should be handled by this Appender. More than one Filter may be
+                used by using a CompositeFilter.</td>
+            </tr>
+            <tr>
+              <td>bufferSize</td>
+              <td>int</td>
+              <td>If an integer greater than 0, this causes the appender to buffer log events and flush whenever the
+                buffer reaches this size.</td>
+            </tr>
+            <tr>
+              <td>connectionSource</td>
+              <td>ConnectionSource</td>
+              <td>The connections source from which database connections should be retrieved.</td>
+            </tr>
+            <tr>
+              <td>tableName</td>
+              <td>String</td>
+              <td>The name of the database table to insert log events into.</td>
+            </tr>
+            <tr>
+              <td>columnConfigs</td>
+              <td>ColumnConfig[]</td>
+              <td>Information about the columns that log event data should be inserted into and how to insert that data.
+                This is represented with multiple &lt;Column /&gt; elements.</td>
+            </tr>
+          </table>
+          <p>
+            Here are a few sample configurations for the JDBCAppender:
+
+            <pre class="prettyprint linenums lang-xml"><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
+<configuration status="error">
+  <appenders>
+    <Jdbc name="databaseAppender" tableName="application_log">
+      <DriverManager jdbcUrl="jdbc:mysql://example.org:3306/exampleDb" username="logging" password="abc123" />
+      <Column name="eventDate" isEventTimestamp="true" />
+      <Column name="level" pattern="%level" />
+      <Column name="logger" pattern="%logger" />
+      <Column name="message" pattern="%message" />
+      <Column name="exception" pattern="%ex{full}" />
+    </Jdbc>
+  </appenders>
+  <loggers>
+    <root level="warn">
+      <appender-ref ref="databaseAppender"/>
+    </root>
+  </loggers>
+</configuration>]]></pre>
+
+            <pre class="prettyprint linenums lang-xml"><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
+<configuration status="error">
+  <appenders>
+    <Jdbc name="databaseAppender" tableName="dbo.application_log">
+      <DataSource jndiName="java:/comp/env/jdbc/ApplicationDataSource" />
+      <Column name="eventDate" isEventTimestamp="true" />
+      <Column name="level" pattern="%level" />
+      <Column name="logger" pattern="%logger" />
+      <Column name="message" pattern="%message" />
+      <Column name="exception" pattern="%ex{full}" />
+    </Jdbc>
+  </appenders>
+  <loggers>
+    <root level="warn">
+      <appender-ref ref="databaseAppender"/>
+    </root>
+  </loggers>
+</configuration>]]></pre>
+
+            <pre class="prettyprint linenums lang-xml"><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
+<configuration status="error">
+  <appenders>
+    <Jdbc name="databaseAppender" tableName="LOGGING.APPLICATION_LOG">
+      <ConnectionFactory class="net.example.db.ConnectionFactory" method="getNewDatabaseConnection" />
+      <Column name="EVENT_ID" literal="LOGGING.APPLICATION_LOG_SEQUENCE.NEXTVAL" />
+      <Column name="EVENT_DATE" isEventTimestamp="true" />
+      <Column name="LEVEL" pattern="%level" />
+      <Column name="LOGGER" pattern="%logger" />
+      <Column name="MESSAGE" pattern="%message" />
+      <Column name="THROWABLE" pattern="%ex{full}" />
+    </Jdbc>
+  </appenders>
+  <loggers>
+    <root level="warn">
+      <appender-ref ref="databaseAppender"/>
+    </root>
+  </loggers>
+</configuration>]]></pre>
+          </p>
+        </subsection>
         <a name="JMSQueueAppender"/>
         <subsection name="JMSQueueAppender">
           <p>The JMSQueueAppender sends the formatted log event to a JMS Queue.</p>
@@ -861,6 +974,217 @@
 </configuration>]]></pre>
           </p>
         </subsection>
+        <a name="JPAAppender"/>
+        <subsection name="JPAAppender">
+          <p>The JPAAppender writes log events to a relational database table using the Java Persistence API.
+            It requires the API and a provider implementation be on the classpath. It also requires a decorated entity
+            configured to persist to the table desired.</p>
+          <table>
+            <tr>
+              <th>Parameter Name</th>
+              <th>Type</th>
+              <th>Description</th>
+            </tr>
+            <tr>
+              <td>name</td>
+              <td>String</td>
+              <td>The name of the Appender.</td>
+            </tr>
+            <tr>
+              <td>suppressExceptions</td>
+              <td>boolean</td>
+              <td>The default is true, causing exceptions to be internally logged and then ignored. When set to false
+                exceptions will be percolated to the caller.</td>
+            </tr>
+            <tr>
+              <td>filter</td>
+              <td>Filter</td>
+              <td>A Filter to determine if the event should be handled by this Appender. More than one Filter may be
+                used by using a CompositeFilter.</td>
+            </tr>
+            <tr>
+              <td>bufferSize</td>
+              <td>int</td>
+              <td>If an integer greater than 0, this causes the appender to buffer log events and flush whenever the
+                buffer reaches this size.</td>
+            </tr>
+            <tr>
+              <td>entityClassName</td>
+              <td>String</td>
+              <td>The fully qualified name of the concrete LogEventWrapperEntity implementation that has JPA annotations
+                mapping it to a database table.</td>
+            </tr>
+            <tr>
+              <td>persistenceUnitName</td>
+              <td>String</td>
+              <td>The name of the JPA persistence unit that should be used for persisting log events.</td>
+            </tr>
+          </table>
+          <p>
+            Here is a sample configurations for the JPAAppender. The first XML sample is the Log4j configuration file,
+            the second is the persistence.xml file. Hibernate ORM is assumed here, but any JPA provider will do:
+
+            <pre class="prettyprint linenums lang-xml"><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
+<configuration status="error">
+  <appenders>
+    <Jpa name="databaseAppender" persistenceUnitName="appPersistenceUnit"
+         entityClassName="com.example.logging.JpaLogEntity" />
+  </appenders>
+  <loggers>
+    <root level="warn">
+      <appender-ref ref="databaseAppender"/>
+    </root>
+  </loggers>
+</configuration>]]></pre>
+
+            <pre class="prettyprint linenums lang-xml"><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
+<persistence xmlns="http://java.sun.com/xml/ns/persistence"
+             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+             xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
+                                 http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
+             version="1.0">
+  <persistence-unit name="appPersistenceUnit">
+    <provider>org.hibernate.ejb.HibernatePersistence</provider>
+    <jpa-data-source>jdbc/ApplicationDataSource</jpa-data-source>
+    <class>com.example.logging.JpaLogEntity</class>
+    <properties>
+      <property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5Dialect" />
+    </properties>
+  </persistence-unit>
+</persistence>]]></pre>
+
+            <pre class="prettyprint linenums lang-java"><![CDATA[package com.example.logging;
+...
+@Entity
+@Table(name="application_log", schema="dbo")
+public class JpaLogEntity extends LogEventWrapperEntity {
+    private static final long serialVersionUID = 1L;
+    private long id = 0L;
+
+    public TestEntity() {
+        super(null);
+    }
+    public TestEntity(LogEvent wrappedEvent) {
+        super(wrappedEvent);
+    }
+
+    @Id
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    @Column(name = "id")
+    public long getId() {
+        return this.id;
+    }
+
+    public void setId(long id) {
+        this.id = id;
+    }
+
+    @Override
+    @Enumerated(EnumType.STRING)
+    @Column(name = "level")
+    public Level getLevel() {
+        return getWrappedEvent().getLevel();
+    }
+
+    @Override
+    @Basic
+    @Column(name = "logger")
+    public String getLoggerName() {
+        return getWrappedEvent().getLoggerName();
+    }
+    ...
+}]]></pre>
+          </p>
+        </subsection>
+        <a name="NoSQLAppender"/>
+        <subsection name="NoSQLAppender">
+          <p>The NoSQLAppender writes log events to a NoSQL database using an internal lightweight provider interface.
+            Provider implementations currently exist for MongoDB and Apache CouchDB, and writing a custom provider is
+            quite simple.</p>
+          <table>
+            <tr>
+              <th>Parameter Name</th>
+              <th>Type</th>
+              <th>Description</th>
+            </tr>
+            <tr>
+              <td>name</td>
+              <td>String</td>
+              <td>The name of the Appender.</td>
+            </tr>
+            <tr>
+              <td>suppressExceptions</td>
+              <td>boolean</td>
+              <td>The default is true, causing exceptions to be internally logged and then ignored. When set to false
+                exceptions will be percolated to the caller.</td>
+            </tr>
+            <tr>
+              <td>filter</td>
+              <td>Filter</td>
+              <td>A Filter to determine if the event should be handled by this Appender. More than one Filter may be
+                used by using a CompositeFilter.</td>
+            </tr>
+            <tr>
+              <td>bufferSize</td>
+              <td>int</td>
+              <td>If an integer greater than 0, this causes the appender to buffer log events and flush whenever the
+                buffer reaches this size.</td>
+            </tr>
+            <tr>
+              <td>noSqlProvider</td>
+              <td>NoSQLProvider&lt;C extends NoSQLConnection&lt;W, T extends NoSQLObject&lt;W&gt;&gt;&gt;</td>
+              <td>The NoSQL provider that provides connections to the chosen NoSQL database.</td>
+            </tr>
+          </table>
+          <p>
+            Here are a few sample configurations for the NoSQLAppender:
+
+            <pre class="prettyprint linenums lang-xml"><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
+<configuration status="error">
+  <appenders>
+    <NoSql name="databaseAppender">
+      <MongoDb databaseName="applicationDb" collectionName="applicationLog" server="mongo.example.org"
+               username="loggingUser" password="abc123" />
+    </NoSql>
+  </appenders>
+  <loggers>
+    <root level="warn">
+      <appender-ref ref="databaseAppender"/>
+    </root>
+  </loggers>
+</configuration>]]></pre>
+
+            <pre class="prettyprint linenums lang-xml"><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
+<configuration status="error">
+  <appenders>
+    <NoSql name="databaseAppender">
+      <MongoDb collectionName="applicationLog" factoryClassName="org.example.db.ConnectionFactory"
+               factoryMethodName="getNewMongoClient" />
+    </NoSql>
+  </appenders>
+  <loggers>
+    <root level="warn">
+      <appender-ref ref="databaseAppender"/>
+    </root>
+  </loggers>
+</configuration>]]></pre>
+
+            <pre class="prettyprint linenums lang-xml"><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
+<configuration status="error">
+  <appenders>
+    <NoSql name="databaseAppender">
+      <CouchDb databaseName="applicationDb" protocol="https" server="couch.example.org"
+               username="loggingUser" password="abc123" />
+    </NoSql>
+  </appenders>
+  <loggers>
+    <root level="warn">
+      <appender-ref ref="databaseAppender"/>
+    </root>
+  </loggers>
+</configuration>]]></pre>
+          </p>
+        </subsection>
         <a name="OutputStreamAppender"/>
         <subsection name="OutputStreamAppender">
           The OutputStreamAppender provides the base for many of the other Appenders such as the File and Socket



Mime
View raw message