logging-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nickwilli...@apache.org
Subject svn commit: r1505218 - in /logging/log4j/log4j2/trunk/core/src/test: java/org/apache/logging/log4j/core/appender/db/jdbc/ resources/org/apache/logging/log4j/core/appender/db/jdbc/ resources/org/apache/logging/log4j/core/appender/db/jpa/
Date Sat, 20 Jul 2013 22:02:39 GMT
Author: nickwilliams
Date: Sat Jul 20 22:02:38 2013
New Revision: 1505218

URL: http://svn.apache.org/r1505218
Log:
Creating performance test for JDBC Appender for H2 and HyperSQL

Modified:
    logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jdbc/AbstractJdbcAppenderTest.java
    logging/log4j/log4j2/trunk/core/src/test/resources/org/apache/logging/log4j/core/appender/db/jdbc/log4j2-data-source.xml
    logging/log4j/log4j2/trunk/core/src/test/resources/org/apache/logging/log4j/core/appender/db/jdbc/log4j2-h2-driver-manager.xml
    logging/log4j/log4j2/trunk/core/src/test/resources/org/apache/logging/log4j/core/appender/db/jdbc/log4j2-h2-factory-method.xml
    logging/log4j/log4j2/trunk/core/src/test/resources/org/apache/logging/log4j/core/appender/db/jdbc/log4j2-hsqldb-driver-manager.xml
    logging/log4j/log4j2/trunk/core/src/test/resources/org/apache/logging/log4j/core/appender/db/jdbc/log4j2-hsqldb-factory-method.xml
    logging/log4j/log4j2/trunk/core/src/test/resources/org/apache/logging/log4j/core/appender/db/jpa/log4j2-jpa-base.xml
    logging/log4j/log4j2/trunk/core/src/test/resources/org/apache/logging/log4j/core/appender/db/jpa/log4j2-jpa-basic.xml

Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jdbc/AbstractJdbcAppenderTest.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jdbc/AbstractJdbcAppenderTest.java?rev=1505218&r1=1505217&r2=1505218&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jdbc/AbstractJdbcAppenderTest.java
(original)
+++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jdbc/AbstractJdbcAppenderTest.java
Sat Jul 20 22:02:38 2013
@@ -265,4 +265,40 @@ public abstract class AbstractJdbcAppend
 
         assertFalse("There should not be three rows.", resultSet.next());
     }
+
+    @Test
+    public void testPerformanceOfAppenderWith10000Events() throws Exception {
+        this.setUp("dmLogEntry", "log4j2-" + this.databaseType + "-driver-manager.xml");
+
+        final RuntimeException exception = new RuntimeException("Hello, world!");
+
+        final Logger logger = LogManager.getLogger(this.getClass().getName() +
+                ".testPerformanceOfAppenderWith10000Events");
+        logger.info("This is a warm-up message.");
+
+        System.out.println("Starting a performance test for JDBC Appender for " + this.databaseType
+ ".");
+
+        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.");
+            }
+        }
+
+        long elapsed = System.nanoTime() - start;
+        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 dmLogEntry 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 + ".");
+    }
 }

Modified: logging/log4j/log4j2/trunk/core/src/test/resources/org/apache/logging/log4j/core/appender/db/jdbc/log4j2-data-source.xml
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/resources/org/apache/logging/log4j/core/appender/db/jdbc/log4j2-data-source.xml?rev=1505218&r1=1505217&r2=1505218&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/test/resources/org/apache/logging/log4j/core/appender/db/jdbc/log4j2-data-source.xml
(original)
+++ logging/log4j/log4j2/trunk/core/src/test/resources/org/apache/logging/log4j/core/appender/db/jdbc/log4j2-data-source.xml
Sat Jul 20 22:02:38 2013
@@ -21,7 +21,7 @@
     <Console name="STDOUT">
       <PatternLayout pattern="%C{1.} %m %level MDC%X%n"/>
     </Console>
-    <Jdbc name="databaseAppender" tableName="dsLogEntry">
+    <Jdbc name="databaseAppender" tableName="dsLogEntry" ignoreExceptions="false">
       <DataSource jndiName="java:/comp/env/jdbc/TestDataSourceAppender" />
       <Column name="eventDate" isEventTimestamp="true" />
       <Column name="literalColumn" literal="'Literal Value of Data Source'" />

Modified: logging/log4j/log4j2/trunk/core/src/test/resources/org/apache/logging/log4j/core/appender/db/jdbc/log4j2-h2-driver-manager.xml
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/resources/org/apache/logging/log4j/core/appender/db/jdbc/log4j2-h2-driver-manager.xml?rev=1505218&r1=1505217&r2=1505218&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/test/resources/org/apache/logging/log4j/core/appender/db/jdbc/log4j2-h2-driver-manager.xml
(original)
+++ logging/log4j/log4j2/trunk/core/src/test/resources/org/apache/logging/log4j/core/appender/db/jdbc/log4j2-h2-driver-manager.xml
Sat Jul 20 22:02:38 2013
@@ -21,7 +21,7 @@
     <Console name="STDOUT">
       <PatternLayout pattern="%C{1.} %m %level MDC%X%n"/>
     </Console>
-    <Jdbc name="databaseAppender" tableName="dmLogEntry">
+    <Jdbc name="databaseAppender" tableName="dmLogEntry" ignoreExceptions="false">
       <DriverManager url="jdbc:h2:mem:Log4j" username="sa" password="" />
       <Column name="eventDate" isEventTimestamp="true" />
       <Column name="literalColumn" literal="'Literal Value Test String'" />
@@ -33,7 +33,7 @@
   </appenders>
 
   <loggers>
-    <logger name="org.apache.logging.log4j.core.appender.db" level="debug">
+    <logger name="org.apache.logging.log4j.core.appender.db" level="debug" additivity="false">
       <appender-ref ref="databaseAppender" />
     </logger>
 

Modified: logging/log4j/log4j2/trunk/core/src/test/resources/org/apache/logging/log4j/core/appender/db/jdbc/log4j2-h2-factory-method.xml
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/resources/org/apache/logging/log4j/core/appender/db/jdbc/log4j2-h2-factory-method.xml?rev=1505218&r1=1505217&r2=1505218&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/test/resources/org/apache/logging/log4j/core/appender/db/jdbc/log4j2-h2-factory-method.xml
(original)
+++ logging/log4j/log4j2/trunk/core/src/test/resources/org/apache/logging/log4j/core/appender/db/jdbc/log4j2-h2-factory-method.xml
Sat Jul 20 22:02:38 2013
@@ -21,7 +21,7 @@
     <Console name="STDOUT">
       <PatternLayout pattern="%C{1.} %m %level MDC%X%n"/>
     </Console>
-    <Jdbc name="databaseAppender" tableName="fmLogEntry">
+    <Jdbc name="databaseAppender" tableName="fmLogEntry" ignoreExceptions="false">
       <ConnectionFactory class="org.apache.logging.log4j.core.appender.db.jdbc.JdbcH2AppenderTest"
                          method="getConfigConnection" />
       <Column name="eventDate" isEventTimestamp="true" />

Modified: logging/log4j/log4j2/trunk/core/src/test/resources/org/apache/logging/log4j/core/appender/db/jdbc/log4j2-hsqldb-driver-manager.xml
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/resources/org/apache/logging/log4j/core/appender/db/jdbc/log4j2-hsqldb-driver-manager.xml?rev=1505218&r1=1505217&r2=1505218&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/test/resources/org/apache/logging/log4j/core/appender/db/jdbc/log4j2-hsqldb-driver-manager.xml
(original)
+++ logging/log4j/log4j2/trunk/core/src/test/resources/org/apache/logging/log4j/core/appender/db/jdbc/log4j2-hsqldb-driver-manager.xml
Sat Jul 20 22:02:38 2013
@@ -21,7 +21,7 @@
     <Console name="STDOUT">
       <PatternLayout pattern="%C{1.} %m %level MDC%X%n"/>
     </Console>
-    <Jdbc name="databaseAppender" tableName="dmLogEntry">
+    <Jdbc name="databaseAppender" tableName="dmLogEntry" ignoreExceptions="false">
       <DriverManager url="jdbc:hsqldb:mem:Log4j;ifexists=true" username="sa" password=""
/>
       <Column name="eventDate" isEventTimestamp="true" />
       <Column name="literalColumn" literal="'Literal Value Test String'" />
@@ -33,7 +33,7 @@
   </appenders>
 
   <loggers>
-    <logger name="org.apache.logging.log4j.core.appender.db" level="debug">
+    <logger name="org.apache.logging.log4j.core.appender.db" level="debug" additivity="false">
       <appender-ref ref="databaseAppender" />
     </logger>
 

Modified: logging/log4j/log4j2/trunk/core/src/test/resources/org/apache/logging/log4j/core/appender/db/jdbc/log4j2-hsqldb-factory-method.xml
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/resources/org/apache/logging/log4j/core/appender/db/jdbc/log4j2-hsqldb-factory-method.xml?rev=1505218&r1=1505217&r2=1505218&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/test/resources/org/apache/logging/log4j/core/appender/db/jdbc/log4j2-hsqldb-factory-method.xml
(original)
+++ logging/log4j/log4j2/trunk/core/src/test/resources/org/apache/logging/log4j/core/appender/db/jdbc/log4j2-hsqldb-factory-method.xml
Sat Jul 20 22:02:38 2013
@@ -21,7 +21,7 @@
     <Console name="STDOUT">
       <PatternLayout pattern="%C{1.} %m %level MDC%X%n"/>
     </Console>
-    <Jdbc name="databaseAppender" tableName="fmLogEntry">
+    <Jdbc name="databaseAppender" tableName="fmLogEntry" ignoreExceptions="false">
       <ConnectionFactory class="org.apache.logging.log4j.core.appender.db.jdbc.JdbcHyperSqlAppenderTest"
                          method="getConfigConnection" />
       <Column name="eventDate" isEventTimestamp="true" />

Modified: logging/log4j/log4j2/trunk/core/src/test/resources/org/apache/logging/log4j/core/appender/db/jpa/log4j2-jpa-base.xml
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/resources/org/apache/logging/log4j/core/appender/db/jpa/log4j2-jpa-base.xml?rev=1505218&r1=1505217&r2=1505218&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/test/resources/org/apache/logging/log4j/core/appender/db/jpa/log4j2-jpa-base.xml
(original)
+++ logging/log4j/log4j2/trunk/core/src/test/resources/org/apache/logging/log4j/core/appender/db/jpa/log4j2-jpa-base.xml
Sat Jul 20 22:02:38 2013
@@ -22,7 +22,7 @@
       <PatternLayout pattern="%C{1.} %m %level MDC%X%n"/>
     </Console>
     <Jpa name="databaseAppender" persistenceUnitName="jpaAppenderTestUnit"
-         entityClassName="org.apache.logging.log4j.core.appender.db.jpa.TestBaseEntity" />
+         entityClassName="org.apache.logging.log4j.core.appender.db.jpa.TestBaseEntity" ignoreExceptions="false"
/>
   </appenders>
 
   <loggers>

Modified: logging/log4j/log4j2/trunk/core/src/test/resources/org/apache/logging/log4j/core/appender/db/jpa/log4j2-jpa-basic.xml
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/resources/org/apache/logging/log4j/core/appender/db/jpa/log4j2-jpa-basic.xml?rev=1505218&r1=1505217&r2=1505218&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/test/resources/org/apache/logging/log4j/core/appender/db/jpa/log4j2-jpa-basic.xml
(original)
+++ logging/log4j/log4j2/trunk/core/src/test/resources/org/apache/logging/log4j/core/appender/db/jpa/log4j2-jpa-basic.xml
Sat Jul 20 22:02:38 2013
@@ -22,7 +22,7 @@
       <PatternLayout pattern="%C{1.} %m %level MDC%X%n"/>
     </Console>
     <Jpa name="databaseAppender" persistenceUnitName="jpaAppenderTestUnit"
-         entityClassName="org.apache.logging.log4j.core.appender.db.jpa.TestBasicEntity"
/>
+         entityClassName="org.apache.logging.log4j.core.appender.db.jpa.TestBasicEntity"
ignoreExceptions="false" />
   </appenders>
 
   <loggers>



Mime
View raw message