Repository: logging-log4j2
Updated Branches:
  refs/heads/master b1255cfd5 -> b647427bd


LOG4J2-842, LOG4J2-843: Migrate JpaHyperSqlAppender and JpaH2Appender
performance test from JUnit to log4j-perf

Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/b647427b
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/b647427b
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/b647427b

Branch: refs/heads/master
Commit: b647427bdd4413137dd4bdd4e8fdd01451c98c9d
Parents: b1255cf
Author: rpopma <[email protected]>
Authored: Sat Sep 20 22:29:18 2014 +0900
Committer: rpopma <[email protected]>
Committed: Sat Sep 20 22:29:18 2014 +0900

----------------------------------------------------------------------
 .../db/jpa/AbstractJpaAppenderTest.java         |  44 +----
 log4j-perf/pom.xml                              |  58 +++++-
 .../log4j/perf/jmh/JpaAppenderBenchmark.java    | 198 +++++++++++++++++++
 .../log4j/perf/jmh/jpa/TestBasicEntity.java     |  66 +++++++
 .../src/main/resources/META-INF/persistence.xml |  73 +++++++
 .../src/main/resources/log4j2-jpa-appender.xml  |  43 ++++
 src/changes/changes.xml                         |  10 +-
 7 files changed, 440 insertions(+), 52 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/b647427b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/AbstractJpaAppenderTest.java
----------------------------------------------------------------------
diff --git 
a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/AbstractJpaAppenderTest.java
 
b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/AbstractJpaAppenderTest.java
index 00cfa73..640a32d 100644
--- 
a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/AbstractJpaAppenderTest.java
+++ 
b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/AbstractJpaAppenderTest.java
@@ -22,16 +22,15 @@ import java.sql.Connection;
 import java.sql.ResultSet;
 import java.sql.SQLException;
 import java.sql.Statement;
+
 import org.apache.logging.log4j.LogManager;
 import org.apache.logging.log4j.Logger;
-import org.apache.logging.log4j.categories.PerformanceTests;
 import org.apache.logging.log4j.core.Appender;
 import org.apache.logging.log4j.core.LoggerContext;
 import org.apache.logging.log4j.core.config.ConfigurationFactory;
 import org.apache.logging.log4j.core.config.DefaultConfiguration;
 import org.apache.logging.log4j.status.StatusLogger;
 import org.junit.Test;
-import org.junit.experimental.categories.Category;
 
 import static org.junit.Assert.*;
 
@@ -210,45 +209,4 @@ public abstract class AbstractJpaAppenderTest {
             this.tearDown();
         }
     }
-
-    @Test
-    @Category(PerformanceTests.class)
-    public void testPerformanceOfAppenderWith10000EventsUsingBasicEntity() 
throws SQLException {
-        try {
-            this.setUp("log4j2-" + this.databaseType + "-jpa-basic.xml");
-
-            final Error exception = new Error("Goodbye, cruel world!");
-
-            final Logger logger = 
LogManager.getLogger(this.getClass().getName() +
-                    
".testPerformanceOfAppenderWith10000EventsUsingBasicEntity");
-            logger.info("This is a warm-up message.");
-
-            System.out.println("Starting a performance test for JPA Appender 
for " + this.databaseType + '.');
-
-            final long start = System.nanoTime();
-
-            for(int i = 0; i < 10000; i++) {
-                if (i % 25 == 0) {
-                    logger.warn("This is an exception message.", exception);
-                } else {
-                    logger.info("This is an info message.");
-                }
-            }
-
-            final long elapsed = System.nanoTime() - start;
-            final long elapsedMilli = elapsed / 1000000;
-
-            final Statement statement = 
this.connection.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,
-                    ResultSet.CONCUR_READ_ONLY);
-            final ResultSet resultSet = statement.executeQuery("SELECT * FROM 
jpaBasicLogEntry ORDER BY id");
-
-            resultSet.last();
-            assertEquals("The number of records is not correct.", 10001, 
resultSet.getRow());
-
-            System.out.println("Wrote 10,000 log events in " + elapsed + " 
nanoseconds (" + elapsedMilli +
-                    " milliseconds) for " + this.databaseType + '.');
-        } finally {
-            this.tearDown();
-        }
-    }
 }

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/b647427b/log4j-perf/pom.xml
----------------------------------------------------------------------
diff --git a/log4j-perf/pom.xml b/log4j-perf/pom.xml
index 3dc7aee..d3d8802 100644
--- a/log4j-perf/pom.xml
+++ b/log4j-perf/pom.xml
@@ -90,6 +90,36 @@
       <groupId>com.h2database</groupId>
       <artifactId>h2</artifactId>
     </dependency>
+    <!-- Used for JPA appenders (needs an implementation of course) -->
+    <dependency>
+      <groupId>javax.persistence</groupId>
+      <artifactId>persistence-api</artifactId>
+      <version>1.0.2</version>
+    </dependency>
+    <dependency>
+      <groupId>org.eclipse.persistence</groupId>
+      <artifactId>javax.persistence</artifactId>
+    </dependency>
+    <!-- JPA Tests -->
+    <dependency>
+      <groupId>org.eclipse.persistence</groupId>
+      <artifactId>eclipselink</artifactId>
+      <version>2.5.2</version>
+    </dependency>
+    <dependency>
+      <groupId>org.eclipse.persistence</groupId>
+      <artifactId>org.eclipse.persistence.jpa</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>com.fasterxml.jackson.core</groupId>
+      <artifactId>jackson-core</artifactId>
+      <optional>true</optional>
+    </dependency>
+    <dependency>
+      <groupId>com.fasterxml.jackson.core</groupId>
+      <artifactId>jackson-databind</artifactId>
+      <optional>true</optional>
+    </dependency>
   </dependencies>
 
   <build>
@@ -105,12 +135,24 @@
               <goal>shade</goal>
             </goals>
             <configuration>
+              <minimizeJar>false</minimizeJar>
               <finalName>microbenchmarks</finalName>
               <transformers>
-                <transformer 
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
+                <transformer
+                  
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                   <mainClass>org.openjdk.jmh.Main</mainClass>
                 </transformer>
               </transformers>
+              <filters>
+                <filter>
+                  <artifact>*:*</artifact>
+                  <excludes>
+                    <exclude>META-INF/*.SF</exclude>
+                    <exclude>META-INF/*.DSA</exclude>
+                    <exclude>META-INF/*.RSA</exclude>
+                  </excludes>
+                </filter>
+              </filters>
             </configuration>
           </execution>
         </executions>
@@ -180,12 +222,14 @@
         <configuration>
           <bottom>Copyright c {inceptionYear}-{currentYear}
             {organizationName}. All Rights Reserved. Apache Logging,
-            Apache Log4j, Log4j, Apache, the Apache feather logo, and the
-            Apache Logging project logo are trademarks of The Apache Software
+            Apache Log4j, Log4j, Apache, the Apache feather logo, and
+            the
+            Apache Logging project logo are trademarks of The Apache
+            Software
             Foundation.
           </bottom>
-          <!-- module link generation is completely broken in the javadoc 
plugin 
-            for a multi-module non-aggregating project -->
+          <!-- module link generation is completely broken in the javadoc 
+            plugin for a multi-module non-aggregating project -->
           <detectOfflineLinks>false</detectOfflineLinks>
           <linksource>true</linksource>
           <tags>
@@ -260,8 +304,8 @@
         <version>${cobertura.plugin.version}</version>
         <reportSets>
           <reportSet>
-            <!-- Disabled as it makes the site build very slow and causes the 
performance 
-              unit test to fail -->
+            <!-- Disabled as it makes the site build very slow and causes 
+              the performance unit test to fail -->
             <reports />
           </reportSet>
         </reportSets>

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/b647427b/log4j-perf/src/main/java/org/apache/logging/log4j/perf/jmh/JpaAppenderBenchmark.java
----------------------------------------------------------------------
diff --git 
a/log4j-perf/src/main/java/org/apache/logging/log4j/perf/jmh/JpaAppenderBenchmark.java
 
b/log4j-perf/src/main/java/org/apache/logging/log4j/perf/jmh/JpaAppenderBenchmark.java
new file mode 100644
index 0000000..d94aaac
--- /dev/null
+++ 
b/log4j-perf/src/main/java/org/apache/logging/log4j/perf/jmh/JpaAppenderBenchmark.java
@@ -0,0 +1,198 @@
+/*
+ * 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.
+ */
+
+package org.apache.logging.log4j.perf.jmh;
+
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.concurrent.TimeUnit;
+
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.core.LoggerContext;
+import org.apache.logging.log4j.core.appender.db.jpa.JpaAppender;
+import org.apache.logging.log4j.core.config.ConfigurationFactory;
+import org.apache.logging.log4j.core.config.DefaultConfiguration;
+import org.apache.logging.log4j.core.util.Closer;
+import org.apache.logging.log4j.status.StatusLogger;
+import org.openjdk.jmh.annotations.BenchmarkMode;
+import org.openjdk.jmh.annotations.GenerateMicroBenchmark;
+import org.openjdk.jmh.annotations.Mode;
+import org.openjdk.jmh.annotations.OutputTimeUnit;
+import org.openjdk.jmh.annotations.Scope;
+import org.openjdk.jmh.annotations.Setup;
+import org.openjdk.jmh.annotations.State;
+import org.openjdk.jmh.annotations.TearDown;
+import org.openjdk.jmh.logic.BlackHole;
+
+/**
+ * Tests the overhead of a number of JPA Appenders.
+ */
+// ============================== HOW TO RUN THIS TEST: 
====================================
+//
+// java -jar log4j-perf/target/microbenchmarks.jar ".*JdbcAppenderBenchmark.*" 
-f 1 -wi 5 -i 5
+//
+// Usage help:
+// java -jar log4j-perf/target/microbenchmarks.jar -help
+//
+@State(Scope.Thread)
+public class JpaAppenderBenchmark {
+    private Logger loggerH2;
+    private Logger loggerHSQLDB;
+    private Connection connectionHSQLDB;
+    private Connection connectionH2;
+    private final RuntimeException exception = new RuntimeException("Hello, 
world!");
+
+    @Setup
+    public void setup() throws Exception {
+        connectionHSQLDB = getConnectionHSQLDB();
+        connectionH2 = getConnectionH2();
+
+        System.setProperty(ConfigurationFactory.CONFIGURATION_FILE_PROPERTY, 
"log4j2-jpa-appender.xml");
+        final LoggerContext context = (LoggerContext) 
LogManager.getContext(false);
+        if (context.getConfiguration() instanceof DefaultConfiguration) {
+            context.reconfigure();
+        }
+        StatusLogger.getLogger().reset();
+        loggerH2 = LogManager.getLogger("H2Logger");
+        loggerHSQLDB = LogManager.getLogger("HSQLDBLogger");
+    }
+
+    @BenchmarkMode(Mode.Throughput)
+    @OutputTimeUnit(TimeUnit.SECONDS)
+    @GenerateMicroBenchmark
+    public void testThroughputH2Message(final BlackHole bh) {
+        loggerH2.info("Test message");
+    }
+
+    @BenchmarkMode(Mode.Throughput)
+    @OutputTimeUnit(TimeUnit.SECONDS)
+    @GenerateMicroBenchmark
+    public void testThroughputH2Exception(final BlackHole bh) {
+        loggerH2.warn("Test message", exception);
+    }
+
+    @BenchmarkMode(Mode.SampleTime)
+    @OutputTimeUnit(TimeUnit.MICROSECONDS)
+    @GenerateMicroBenchmark
+    public void testResponseTimeH2Message(final BlackHole bh) {
+        loggerH2.info("Test message");
+    }
+
+    @BenchmarkMode(Mode.SampleTime)
+    @OutputTimeUnit(TimeUnit.MICROSECONDS)
+    @GenerateMicroBenchmark
+    public void testResponseTimeH2Exception(final BlackHole bh) {
+        loggerH2.warn("Test message", exception);
+    }
+
+    @BenchmarkMode(Mode.Throughput)
+    @OutputTimeUnit(TimeUnit.SECONDS)
+    @GenerateMicroBenchmark
+    public void testThroughputHSQLDBMessage(final BlackHole bh) {
+        loggerHSQLDB.info("Test message");
+    }
+
+    @BenchmarkMode(Mode.Throughput)
+    @OutputTimeUnit(TimeUnit.SECONDS)
+    @GenerateMicroBenchmark
+    public void testThroughputHSQLDBException(final BlackHole bh) {
+        loggerHSQLDB.warn("Test message", exception);
+    }
+
+    @BenchmarkMode(Mode.SampleTime)
+    @OutputTimeUnit(TimeUnit.MICROSECONDS)
+    @GenerateMicroBenchmark
+    public void testResponseTimeHSQLDBMessage(final BlackHole bh) {
+        loggerHSQLDB.info("Test message");
+    }
+
+    @BenchmarkMode(Mode.SampleTime)
+    @OutputTimeUnit(TimeUnit.MICROSECONDS)
+    @GenerateMicroBenchmark
+    public void testResponseTimeHSQLDBException(final BlackHole bh) {
+        loggerHSQLDB.warn("Test message", exception);
+    }
+
+    @TearDown
+    public void tearDown() throws SQLException {
+        final LoggerContext context = (LoggerContext) 
LogManager.getContext(false);
+        try {
+            ((JpaAppender) 
context.getConfiguration().getAppender("H2Appender")).getManager().release();
+            ((JpaAppender) 
context.getConfiguration().getAppender("HSQLDBAppender")).getManager().release();
+        } finally {
+            
System.clearProperty(ConfigurationFactory.CONFIGURATION_FILE_PROPERTY);
+            // context.reconfigure();
+            // StatusLogger.getLogger().reset();
+
+            Statement statement = null;
+            try {
+                statement = connectionHSQLDB.createStatement();
+                statement.execute("SHUTDOWN");
+            } catch (SQLException ignore) {
+                // ignore
+            } finally {
+                Closer.closeSilently(statement);
+                Closer.closeSilently(connectionHSQLDB);
+            }
+            try {
+                statement = connectionH2.createStatement();
+                statement.execute("SHUTDOWN");
+            } catch (SQLException ignore) {
+                // ignore
+            } finally {
+                Closer.closeSilently(statement);
+                Closer.closeSilently(connectionH2);
+            }
+        }
+    }
+
+    /**
+     * Referred from log4j2-jdbc-appender.xml.
+     */
+    public static Connection getConnectionH2() throws Exception {
+        Class.forName("org.h2.Driver");
+        Connection connection = 
DriverManager.getConnection("jdbc:h2:mem:Log4j", "sa", "");
+        Statement statement = connection.createStatement();
+        statement
+                .executeUpdate("CREATE TABLE jpaBasicLogEntry ( "
+                        + "id INTEGER IDENTITY, timemillis BIGINT, level 
NVARCHAR(10), loggerName NVARCHAR(255), "
+                        + "message NVARCHAR(1024), thrown NVARCHAR(1048576), 
contextMapJson NVARCHAR(1048576),"
+                        + "loggerFQCN NVARCHAR(1024), contextStack 
NVARCHAR(1048576), marker NVARCHAR(255), source NVARCHAR(2048),"
+                        + "threadName NVARCHAR(255)" + " )");
+        statement.close();
+        return connection;
+    }
+
+    /**
+     * Referred from log4j2-jdbc-appender.xml.
+     */
+    public static Connection getConnectionHSQLDB() throws Exception {
+        Class.forName("org.hsqldb.jdbcDriver");
+        Connection connection = 
DriverManager.getConnection("jdbc:hsqldb:mem:Log4j", "sa", "");
+        Statement statement = connection.createStatement();
+        statement.executeUpdate("CREATE TABLE jpaBasicLogEntry ( "
+                + "id INTEGER IDENTITY, timemillis BIGINT, level VARCHAR(10), 
loggerName VARCHAR(255), "
+                + "message VARCHAR(1024), thrown VARCHAR(1048576), 
contextMapJson VARCHAR(1048576),"
+                + "loggerFQCN VARCHAR(1024), contextStack VARCHAR(1048576), 
marker VARCHAR(255), source VARCHAR(2048),"
+                + "threadName VARCHAR(255)" + " )");
+        statement.close();
+        return connection;
+    }
+}

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/b647427b/log4j-perf/src/main/java/org/apache/logging/log4j/perf/jmh/jpa/TestBasicEntity.java
----------------------------------------------------------------------
diff --git 
a/log4j-perf/src/main/java/org/apache/logging/log4j/perf/jmh/jpa/TestBasicEntity.java
 
b/log4j-perf/src/main/java/org/apache/logging/log4j/perf/jmh/jpa/TestBasicEntity.java
new file mode 100644
index 0000000..b1e43d4
--- /dev/null
+++ 
b/log4j-perf/src/main/java/org/apache/logging/log4j/perf/jmh/jpa/TestBasicEntity.java
@@ -0,0 +1,66 @@
+/*
+ * 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.
+ */
+package org.apache.logging.log4j.perf.jmh.jpa;
+
+import java.util.Map;
+
+import javax.persistence.Column;
+import javax.persistence.Convert;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+import org.apache.logging.log4j.core.LogEvent;
+import org.apache.logging.log4j.core.appender.db.jpa.BasicLogEventEntity;
+import 
org.apache.logging.log4j.core.appender.db.jpa.converter.ContextMapJsonAttributeConverter;
+
+@Entity
+@Table(name = "jpaBasicLogEntry")
+@SuppressWarnings("unused")
+public class TestBasicEntity extends BasicLogEventEntity {
+    private static final long serialVersionUID = 1L;
+
+    private long id = 0L;
+
+    public TestBasicEntity() {
+        super();
+    }
+
+    public TestBasicEntity(final LogEvent wrapped) {
+        super(wrapped);
+    }
+
+    @Id
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    @Column(name = "id")
+    public long getId() {
+        return this.id;
+    }
+
+    public void setId(final long id) {
+        this.id = id;
+    }
+
+    @Override
+    @Convert(converter = ContextMapJsonAttributeConverter.class)
+    @Column(name = "contextMapJson")
+    public Map<String, String> getContextMap() {
+        return super.getContextMap();
+    }
+}

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/b647427b/log4j-perf/src/main/resources/META-INF/persistence.xml
----------------------------------------------------------------------
diff --git a/log4j-perf/src/main/resources/META-INF/persistence.xml 
b/log4j-perf/src/main/resources/META-INF/persistence.xml
new file mode 100644
index 0000000..c174abc
--- /dev/null
+++ b/log4j-perf/src/main/resources/META-INF/persistence.xml
@@ -0,0 +1,73 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+
+-->
+<persistence xmlns="http://xmlns.jcp.org/xml/ns/persistence";
+             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+             xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence
+                                 
http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd";
+             version="2.1">
+
+  <persistence-unit name="hyperSqlJpaAppenderTestUnit">
+    <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
+    
<class>org.apache.logging.log4j.core.appender.db.jpa.converter.ContextMapAttributeConverter</class>
+    
<class>org.apache.logging.log4j.core.appender.db.jpa.converter.ContextMapJsonAttributeConverter</class>
+    
<class>org.apache.logging.log4j.core.appender.db.jpa.converter.ContextStackAttributeConverter</class>
+    
<class>org.apache.logging.log4j.core.appender.db.jpa.converter.ContextStackJsonAttributeConverter</class>
+    
<class>org.apache.logging.log4j.core.appender.db.jpa.converter.LevelAttributeConverter</class>
+    
<class>org.apache.logging.log4j.core.appender.db.jpa.converter.MarkerAttributeConverter</class>
+    
<class>org.apache.logging.log4j.core.appender.db.jpa.converter.MessageAttributeConverter</class>
+    
<class>org.apache.logging.log4j.core.appender.db.jpa.converter.StackTraceElementAttributeConverter</class>
+    
<class>org.apache.logging.log4j.core.appender.db.jpa.converter.ThrowableAttributeConverter</class>
+    <exclude-unlisted-classes>false</exclude-unlisted-classes>
+    <shared-cache-mode>NONE</shared-cache-mode>
+    <properties>
+      <property name="javax.persistence.jdbc.driver" 
value="org.hsqldb.jdbcDriver"/>
+      <property name="javax.persistence.jdbc.url" 
value="jdbc:hsqldb:mem:Log4j;ifexists=true"/>
+      <property name="javax.persistence.jdbc.user" value="sa"/>
+      <property name="javax.persistence.jdbc.password" value=""/>
+      <!--<property name="eclipselink.logging.level" value="FINE"/>
+      <property name="eclipselink.logging.level.sql" value="FINE"/>
+      <property name="eclipselink.logging.parameters" value="true"/> uncomment 
to troubleshoot SQL-->
+    </properties>
+  </persistence-unit>
+
+  <persistence-unit name="h2JpaAppenderTestUnit">
+    <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
+    
<class>org.apache.logging.log4j.core.appender.db.jpa.converter.ContextMapAttributeConverter</class>
+    
<class>org.apache.logging.log4j.core.appender.db.jpa.converter.ContextMapJsonAttributeConverter</class>
+    
<class>org.apache.logging.log4j.core.appender.db.jpa.converter.ContextStackAttributeConverter</class>
+    
<class>org.apache.logging.log4j.core.appender.db.jpa.converter.ContextStackJsonAttributeConverter</class>
+    
<class>org.apache.logging.log4j.core.appender.db.jpa.converter.LevelAttributeConverter</class>
+    
<class>org.apache.logging.log4j.core.appender.db.jpa.converter.MarkerAttributeConverter</class>
+    
<class>org.apache.logging.log4j.core.appender.db.jpa.converter.MessageAttributeConverter</class>
+    
<class>org.apache.logging.log4j.core.appender.db.jpa.converter.StackTraceElementAttributeConverter</class>
+    
<class>org.apache.logging.log4j.core.appender.db.jpa.converter.ThrowableAttributeConverter</class>
+    <exclude-unlisted-classes>false</exclude-unlisted-classes>
+    <shared-cache-mode>NONE</shared-cache-mode>
+    <properties>
+      <property name="javax.persistence.jdbc.driver" value="org.h2.Driver"/>
+      <property name="javax.persistence.jdbc.url" value="jdbc:h2:mem:Log4j"/>
+      <property name="javax.persistence.jdbc.user" value="sa"/>
+      <property name="javax.persistence.jdbc.password" value=""/>
+      <!--<property name="eclipselink.logging.level" value="FINE"/>
+      <property name="eclipselink.logging.level.sql" value="FINE"/>
+      <property name="eclipselink.logging.parameters" value="true"/> uncomment 
to troubleshoot SQL-->
+    </properties>
+  </persistence-unit>
+
+</persistence>

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/b647427b/log4j-perf/src/main/resources/log4j2-jpa-appender.xml
----------------------------------------------------------------------
diff --git a/log4j-perf/src/main/resources/log4j2-jpa-appender.xml 
b/log4j-perf/src/main/resources/log4j2-jpa-appender.xml
new file mode 100644
index 0000000..156030a
--- /dev/null
+++ b/log4j-perf/src/main/resources/log4j2-jpa-appender.xml
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<Configuration status="OFF">
+
+  <Appenders>
+    <Console name="STDOUT">
+      <PatternLayout pattern="%C{1.} %m %level MDC%X%n"/>
+    </Console>
+    <Jpa name="H2Appender" persistenceUnitName="h2JpaAppenderTestUnit"
+         
entityClassName="org.apache.logging.log4j.perf.jmh.jpa.TestBasicEntity" 
ignoreExceptions="false" />
+    <Jpa name="HSQLDBAppender" 
persistenceUnitName="hyperSqlJpaAppenderTestUnit"
+         
entityClassName="org.apache.logging.log4j.perf.jmh.jpa.TestBasicEntity" 
ignoreExceptions="false" />
+  </Appenders>
+
+  <Loggers>
+    <Logger name="H2Logger" level="debug" additivity="false">
+      <AppenderRef ref="H2Appender" />
+    </Logger>
+    <Logger name="HSQLDBLogger" level="debug" additivity="false">
+      <AppenderRef ref="HSQLDBAppender" />
+    </Logger>
+
+    <Root level="fatal">
+      <AppenderRef ref="STDOUT"/>
+    </Root>
+  </Loggers>
+
+</Configuration>

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/b647427b/src/changes/changes.xml
----------------------------------------------------------------------
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index d237157..3475622 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -24,11 +24,17 @@
   </properties>
   <body>
     <release version="2.1" date="2014-??-??" description="Bug fixes and 
enhancements">
+      <action issue="LOG4J2-843" dev="rpopma" type="fix">
+        Migrate JpaHyperSqlAppenderTest JUnit performance test to log4j-perf.
+      </action>
+      <action issue="LOG4J2-842" dev="rpopma" type="fix">
+        Migrate JpaH2AppenderTest JUnit performance test to log4j-perf.
+      </action>
       <action issue="LOG4J2-841" dev="rpopma" type="fix">
-        Migrate 
JdbcHyperSqlAppenderTest#testPerformanceOfAppenderWith1000Events() to 
log4j-perf.
+        Migrate JdbcHyperSqlAppenderTest JUnit performance test to log4j-perf.
       </action>
       <action issue="LOG4J2-840" dev="rpopma" type="fix">
-        Migrate JdbcH2AppenderTest#testPerformanceOfAppenderWith1000Events() 
to log4j-perf.
+        Migrate JdbcH2AppenderTest JUnit performance test to log4j-perf.
       </action>
       <action issue="LOG4J2-830" dev="rpopma" type="fix">
         Respect external interrupt signal to allow application shutdown after 
joining AsyncAppender thread.

Reply via email to