logging-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject svn commit: r1482660 - in /logging/log4j/log4j2/trunk/core: ./ src/test/java/org/apache/logging/log4j/core/appender/db/jdbc/ src/test/resources/org/apache/logging/log4j/core/appender/db/jdbc/
Date Wed, 15 May 2013 02:23:47 GMT
Author: ggregory
Date: Wed May 15 02:23:46 2013
New Revision: 1482660

URL: http://svn.apache.org/r1482660
Log:
Refactor the JDBC test class to test another database: H2. I think this raises the level of
confidence in the JDBC appender code and tests.

Added:
    logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jdbc/AbstractJdbcAppenderTest.java
      - copied, changed from r1482645, logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jdbc/JDBCAppenderTest.java
    logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jdbc/JdbcH2AppenderTest.java
  (with props)
    logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jdbc/JdbcHyperSqlAppenderTest.java
  (with props)
    logging/log4j/log4j2/trunk/core/src/test/resources/org/apache/logging/log4j/core/appender/db/jdbc/log4j2-h2-driver-manager.xml
      - copied, changed from r1482645, logging/log4j/log4j2/trunk/core/src/test/resources/org/apache/logging/log4j/core/appender/db/jdbc/log4j2-driver-manager.xml
    logging/log4j/log4j2/trunk/core/src/test/resources/org/apache/logging/log4j/core/appender/db/jdbc/log4j2-h2-factory-method.xml
  (with props)
    logging/log4j/log4j2/trunk/core/src/test/resources/org/apache/logging/log4j/core/appender/db/jdbc/log4j2-hsqldb-driver-manager.xml
  (with props)
    logging/log4j/log4j2/trunk/core/src/test/resources/org/apache/logging/log4j/core/appender/db/jdbc/log4j2-hsqldb-factory-method.xml
      - copied, changed from r1482645, logging/log4j/log4j2/trunk/core/src/test/resources/org/apache/logging/log4j/core/appender/db/jdbc/log4j2-factory-method.xml
Removed:
    logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jdbc/JDBCAppenderTest.java
    logging/log4j/log4j2/trunk/core/src/test/resources/org/apache/logging/log4j/core/appender/db/jdbc/log4j2-driver-manager.xml
    logging/log4j/log4j2/trunk/core/src/test/resources/org/apache/logging/log4j/core/appender/db/jdbc/log4j2-factory-method.xml
Modified:
    logging/log4j/log4j2/trunk/core/pom.xml

Modified: logging/log4j/log4j2/trunk/core/pom.xml
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/pom.xml?rev=1482660&r1=1482659&r2=1482660&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/pom.xml (original)
+++ logging/log4j/log4j2/trunk/core/pom.xml Wed May 15 02:23:46 2013
@@ -105,6 +105,11 @@
       <scope>test</scope>
     </dependency>
     <dependency>
+      <groupId>com.h2database</groupId>
+      <artifactId>h2</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
       <groupId>org.hibernate</groupId>
       <artifactId>hibernate-entitymanager</artifactId>
       <scope>test</scope>

Copied: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jdbc/AbstractJdbcAppenderTest.java
(from r1482645, logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jdbc/JDBCAppenderTest.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?p2=logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jdbc/AbstractJdbcAppenderTest.java&p1=logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jdbc/JDBCAppenderTest.java&r1=1482645&r2=1482660&rev=1482660&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jdbc/JDBCAppenderTest.java
(original)
+++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jdbc/AbstractJdbcAppenderTest.java
Wed May 15 02:23:46 2013
@@ -16,6 +16,26 @@
  */
 package org.apache.logging.log4j.core.appender.db.jdbc;
 
+import static org.easymock.EasyMock.createStrictMock;
+import static org.easymock.EasyMock.expect;
+import static org.easymock.EasyMock.replay;
+import static org.easymock.EasyMock.verify;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.io.ByteArrayOutputStream;
+import java.io.PrintWriter;
+import java.sql.Connection;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.Map;
+
+import javax.naming.InitialContext;
+import javax.sql.DataSource;
+
 import org.apache.logging.log4j.LogManager;
 import org.apache.logging.log4j.Logger;
 import org.apache.logging.log4j.core.Appender;
@@ -28,33 +48,26 @@ import org.junit.After;
 import org.junit.Test;
 import org.mockejb.jndi.MockContextFactory;
 
-import javax.naming.InitialContext;
-import javax.sql.DataSource;
-import java.io.ByteArrayOutputStream;
-import java.io.PrintWriter;
-import java.sql.Connection;
-import java.sql.DriverManager;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.sql.Statement;
-import java.util.Map;
+public abstract class AbstractJdbcAppenderTest {
 
-import static org.easymock.EasyMock.*;
-import static org.junit.Assert.*;
+    private final String dbType;
 
-public class JDBCAppenderTest {
     private Connection connection;
 
-    public void setUp(final String tableName, final String configFileName) throws SQLException
{
-        this.connection = DriverManager.getConnection("jdbc:hsqldb:mem:Log4j", "sa", "");
+    public AbstractJdbcAppenderTest(final String dbType) {
+        this.dbType = dbType;
+    }
 
-        final Statement statement = this.connection.createStatement();
-        statement.executeUpdate("CREATE TABLE " + tableName + " ( " +
-                    "id INTEGER IDENTITY, eventDate DATETIME, literalColumn VARCHAR(255),
level VARCHAR(10), "  +
-                    "logger VARCHAR(255), message VARCHAR(1024), exception VARCHAR(1048576)"
+
-                " )");
-        statement.close();
+    protected abstract Connection newConnection() throws SQLException;
 
+    protected void setUp(final String tableName, final String configFileName) throws SQLException
{
+        this.connection = this.newConnection();
+        final Statement statement = this.connection.createStatement();
+        try {
+            statement.executeUpdate(toCreateTableSqlString(tableName));
+        } finally {
+            statement.close();
+        }
         System.setProperty(ConfigurationFactory.CONFIGURATION_FILE_PROPERTY,
                 "org/apache/logging/log4j/core/appender/db/jdbc/" + configFileName);
         final LoggerContext context = (LoggerContext) LogManager.getContext(false);
@@ -64,6 +77,15 @@ public class JDBCAppenderTest {
         StatusLogger.getLogger().reset();
     }
 
+    protected void setUpTable(final String tableName) throws SQLException {
+        final Statement statement = this.connection.createStatement();
+        try {
+            statement.executeUpdate(toCreateTableSqlString(tableName));
+        } finally {
+            statement.close();
+        }
+    }
+
     @After
     public void tearDown() throws SQLException {
         final LoggerContext context = (LoggerContext) LogManager.getContext(false);
@@ -96,8 +118,76 @@ public class JDBCAppenderTest {
     }
 
     @Test
+    public void testDataSourceConfig() throws Exception {
+        System.out.println("Before creating mock data source.");
+        final DataSource dataSource = createStrictMock(DataSource.class);
+
+        expect(dataSource.getConnection()).andAnswer(new IAnswer<Connection>() {
+            @Override
+            public Connection answer() throws Throwable {
+                return newConnection();
+            }
+        }).atLeastOnce();
+        replay(dataSource);
+
+        System.out.println("Before creating mock context.");
+        MockContextFactory.setAsInitial();
+
+        System.out.println("Before instantiating context.");
+        final InitialContext context = new InitialContext();
+        context.createSubcontext("java:");
+        context.createSubcontext("java:/comp");
+        context.createSubcontext("java:/comp/env");
+        context.createSubcontext("java:/comp/env/jdbc");
+
+        System.out.println("Before binding data source.");
+        context.bind("java:/comp/env/jdbc/TestDataSourceAppender", dataSource);
+
+        try {
+            System.out.println("Before setting up.");
+            this.setUp("dsLogEntry", "log4j2-data-source.xml");
+
+            System.out.println("After setting up.");
+            final Error exception = new Error("Final error massage is fatal!");
+            final ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
+            final PrintWriter writer = new PrintWriter(outputStream);
+            exception.printStackTrace(writer);
+            writer.close();
+            final String stackTrace = outputStream.toString();
+
+            final long millis = System.currentTimeMillis();
+
+            final Logger logger = LogManager.getLogger(this.getClass().getName() + ".testDataSourceConfig");
+            logger.trace("Data source logged message 01.");
+            logger.fatal("Error from data source 02.", exception);
+
+            final Statement statement = this.connection.createStatement();
+            final ResultSet resultSet = statement.executeQuery("SELECT * FROM dsLogEntry
ORDER BY id");
+
+            assertTrue("There should be at least one row.", resultSet.next());
+
+            final long date = resultSet.getTimestamp("eventDate").getTime();
+            assertTrue("The date should be later than pre-logging (1).", date >= millis);
+            assertTrue("The date should be earlier than now (1).", date <= System.currentTimeMillis());
+            assertEquals("The literal column is not correct (1).", "Literal Value of Data
Source",
+                    resultSet.getString("literalColumn"));
+            assertEquals("The level column is not correct (1).", "FATAL", resultSet.getString("level"));
+            assertEquals("The logger column is not correct (1).", logger.getName(), resultSet.getString("logger"));
+            assertEquals("The message column is not correct (1).", "Error from data source
02.",
+                    resultSet.getString("message"));
+            assertEquals("The exception column is not correct (1).", stackTrace, resultSet.getString("exception"));
+
+            assertFalse("There should not be two rows.", resultSet.next());
+
+            verify(dataSource);
+        } finally {
+            MockContextFactory.revertSetAsInitial();
+        }
+    }
+
+    @Test
     public void testDriverManagerConfig() throws SQLException {
-        this.setUp("dmLogEntry", "log4j2-driver-manager.xml");
+        this.setUp("dmLogEntry", "log4j2-" + this.dbType + "-driver-manager.xml");
 
         final RuntimeException exception = new RuntimeException("Hello, world!");
         final ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
@@ -145,7 +235,7 @@ public class JDBCAppenderTest {
 
     @Test
     public void testFactoryMethodConfig() throws SQLException {
-        this.setUp("fmLogEntry", "log4j2-factory-method.xml");
+        this.setUp("fmLogEntry", "log4j2-" + this.dbType + "-factory-method.xml");
 
         final SQLException exception = new SQLException("Some other error message!");
         final ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
@@ -191,76 +281,10 @@ public class JDBCAppenderTest {
         assertFalse("There should not be three rows.", resultSet.next());
     }
 
-    @Test
-    public void testDataSourceConfig() throws Exception {
-        System.out.println("Before creating mock data source.");
-        DataSource dataSource = createStrictMock(DataSource.class);
-
-        expect(dataSource.getConnection()).andAnswer(new IAnswer<Connection>() {
-            @Override
-            public Connection answer() throws Throwable {
-                return DriverManager.getConnection("jdbc:hsqldb:mem:Log4j", "sa", "");
-            }
-        }).atLeastOnce();
-        replay(dataSource);
-
-        System.out.println("Before creating mock context.");
-        MockContextFactory.setAsInitial();
-
-        System.out.println("Before instantiating context.");
-        InitialContext context = new InitialContext();
-        context.createSubcontext("java:");
-        context.createSubcontext("java:/comp");
-        context.createSubcontext("java:/comp/env");
-        context.createSubcontext("java:/comp/env/jdbc");
-
-        System.out.println("Before binding data source.");
-        context.bind("java:/comp/env/jdbc/TestDataSourceAppender", dataSource);
-
-        try {
-            System.out.println("Before setting up.");
-            this.setUp("dsLogEntry", "log4j2-data-source.xml");
-
-            System.out.println("After setting up.");
-            final Error exception = new Error("Final error massage is fatal!");
-            final ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
-            final PrintWriter writer = new PrintWriter(outputStream);
-            exception.printStackTrace(writer);
-            writer.close();
-            final String stackTrace = outputStream.toString();
-
-            final long millis = System.currentTimeMillis();
-
-            final Logger logger = LogManager.getLogger(this.getClass().getName() + ".testDataSourceConfig");
-            logger.trace("Data source logged message 01.");
-            logger.fatal("Error from data source 02.", exception);
-
-            final Statement statement = this.connection.createStatement();
-            final ResultSet resultSet = statement.executeQuery("SELECT * FROM dsLogEntry
ORDER BY id");
-
-            assertTrue("There should be at least one row.", resultSet.next());
-
-            long date = resultSet.getTimestamp("eventDate").getTime();
-            assertTrue("The date should be later than pre-logging (1).", date >= millis);
-            assertTrue("The date should be earlier than now (1).", date <= System.currentTimeMillis());
-            assertEquals("The literal column is not correct (1).", "Literal Value of Data
Source",
-                    resultSet.getString("literalColumn"));
-            assertEquals("The level column is not correct (1).", "FATAL", resultSet.getString("level"));
-            assertEquals("The logger column is not correct (1).", logger.getName(), resultSet.getString("logger"));
-            assertEquals("The message column is not correct (1).", "Error from data source
02.",
-                    resultSet.getString("message"));
-            assertEquals("The exception column is not correct (1).", stackTrace, resultSet.getString("exception"));
-
-            assertFalse("There should not be two rows.", resultSet.next());
-
-            verify(dataSource);
-        } finally {
-            MockContextFactory.revertSetAsInitial();
-        }
+    protected String toCreateTableSqlString(final String tableName) {
+        return "CREATE TABLE " + tableName + " ( "
+                + "id INTEGER IDENTITY, eventDate DATETIME, literalColumn VARCHAR(255), level
VARCHAR(10), "
+                + "logger VARCHAR(255), message VARCHAR(1024), exception VARCHAR(1048576)"
+ " )";
     }
 
-    @SuppressWarnings("unused")
-    public static Connection testFactoryMethodConfigMethod() throws SQLException {
-        return DriverManager.getConnection("jdbc:hsqldb:mem:Log4j;ifexists=true", "sa", "");
-    }
 }

Added: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jdbc/JdbcH2AppenderTest.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jdbc/JdbcH2AppenderTest.java?rev=1482660&view=auto
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jdbc/JdbcH2AppenderTest.java
(added)
+++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jdbc/JdbcH2AppenderTest.java
Wed May 15 02:23:46 2013
@@ -0,0 +1,48 @@
+/*
+ * 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.core.appender.db.jdbc;
+
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.SQLException;
+
+/**
+ * Tests the JDBC appender with the H2 database in memory.
+ */
+public class JdbcH2AppenderTest extends AbstractJdbcAppenderTest {
+
+    private static final String PASSWORD = "";
+    private static final String USER_ID = "sa";
+
+    /**
+     * Referred from log4j2-factory-method.xml.
+     */
+    @SuppressWarnings("unused")
+    public static Connection getConfigConnection() throws SQLException {
+        return DriverManager.getConnection("jdbc:h2:mem:Log4j", USER_ID, PASSWORD);
+    }
+
+    public JdbcH2AppenderTest() {
+        super("h2");
+    }
+
+    @Override
+    protected Connection newConnection() throws SQLException {
+        return DriverManager.getConnection("jdbc:h2:mem:Log4j", USER_ID, PASSWORD);
+    }
+
+}

Propchange: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jdbc/JdbcH2AppenderTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jdbc/JdbcH2AppenderTest.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jdbc/JdbcHyperSqlAppenderTest.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jdbc/JdbcHyperSqlAppenderTest.java?rev=1482660&view=auto
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jdbc/JdbcHyperSqlAppenderTest.java
(added)
+++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jdbc/JdbcHyperSqlAppenderTest.java
Wed May 15 02:23:46 2013
@@ -0,0 +1,45 @@
+/*
+ * 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.core.appender.db.jdbc;
+
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.SQLException;
+
+/**
+ * Tests the JDBC appender with the HyperSQL database (a.k.a. HSQLDB) in memory.
+ */
+public class JdbcHyperSqlAppenderTest extends AbstractJdbcAppenderTest {
+
+    /**
+     * Referred from log4j2-factory-method.xml.
+     */
+    @SuppressWarnings("unused")
+    public static Connection getConfigConnection() throws SQLException {
+        return DriverManager.getConnection("jdbc:hsqldb:mem:Log4j;ifexists=true", "sa", "");
+    }
+
+    public JdbcHyperSqlAppenderTest() {
+        super("hsqldb");
+    }
+
+    @Override
+    protected Connection newConnection() throws SQLException {
+        return DriverManager.getConnection("jdbc:hsqldb:mem:Log4j", "sa", "");
+    }
+
+}

Propchange: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jdbc/JdbcHyperSqlAppenderTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jdbc/JdbcHyperSqlAppenderTest.java
------------------------------------------------------------------------------
    svn:keywords = Id

Copied: logging/log4j/log4j2/trunk/core/src/test/resources/org/apache/logging/log4j/core/appender/db/jdbc/log4j2-h2-driver-manager.xml
(from r1482645, logging/log4j/log4j2/trunk/core/src/test/resources/org/apache/logging/log4j/core/appender/db/jdbc/log4j2-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?p2=logging/log4j/log4j2/trunk/core/src/test/resources/org/apache/logging/log4j/core/appender/db/jdbc/log4j2-h2-driver-manager.xml&p1=logging/log4j/log4j2/trunk/core/src/test/resources/org/apache/logging/log4j/core/appender/db/jdbc/log4j2-driver-manager.xml&r1=1482645&r2=1482660&rev=1482660&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/test/resources/org/apache/logging/log4j/core/appender/db/jdbc/log4j2-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
Wed May 15 02:23:46 2013
@@ -22,7 +22,7 @@
       <PatternLayout pattern="%C{1.} %m %level MDC%X%n"/>
     </Console>
     <Jdbc name="databaseAppender" tableName="dmLogEntry">
-      <DriverManager url="jdbc:hsqldb:mem:Log4j;ifexists=true" username="sa" password=""
/>
+      <DriverManager url="jdbc:h2:mem:Log4j" username="sa" password="" />
       <Column name="eventDate" isEventTimestamp="true" />
       <Column name="literalColumn" literal="'Literal Value Test String'" />
       <Column name="level" pattern="%level" />

Added: 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=1482660&view=auto
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/test/resources/org/apache/logging/log4j/core/appender/db/jdbc/log4j2-h2-factory-method.xml
(added)
+++ logging/log4j/log4j2/trunk/core/src/test/resources/org/apache/logging/log4j/core/appender/db/jdbc/log4j2-h2-factory-method.xml
Wed May 15 02:23:46 2013
@@ -0,0 +1,46 @@
+<?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="debug">
+
+  <appenders>
+    <Console name="STDOUT">
+      <PatternLayout pattern="%C{1.} %m %level MDC%X%n"/>
+    </Console>
+    <Jdbc name="databaseAppender" tableName="fmLogEntry">
+      <ConnectionFactory class="org.apache.logging.log4j.core.appender.db.jdbc.JdbcH2AppenderTest"
+         method="getConfigConnection" />
+      <Column name="eventDate" isEventTimestamp="true" />
+      <Column name="literalColumn" literal="'Some Other Literal Value'" />
+      <Column name="level" pattern="%level" />
+      <Column name="logger" pattern="%logger" />
+      <Column name="message" pattern="%message" />
+      <Column name="exception" pattern="%ex{full}" />
+    </Jdbc>
+  </appenders>
+
+  <loggers>
+    <logger name="org.apache.logging.log4j.core.appender.db" level="debug">
+      <appender-ref ref="databaseAppender" />
+    </logger>
+
+    <root level="error">
+      <appender-ref ref="STDOUT"/>
+    </root>
+  </loggers>
+
+</configuration>

Propchange: logging/log4j/log4j2/trunk/core/src/test/resources/org/apache/logging/log4j/core/appender/db/jdbc/log4j2-h2-factory-method.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: logging/log4j/log4j2/trunk/core/src/test/resources/org/apache/logging/log4j/core/appender/db/jdbc/log4j2-h2-factory-method.xml
------------------------------------------------------------------------------
    svn:keywords = Id

Added: 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=1482660&view=auto
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/test/resources/org/apache/logging/log4j/core/appender/db/jdbc/log4j2-hsqldb-driver-manager.xml
(added)
+++ logging/log4j/log4j2/trunk/core/src/test/resources/org/apache/logging/log4j/core/appender/db/jdbc/log4j2-hsqldb-driver-manager.xml
Wed May 15 02:23:46 2013
@@ -0,0 +1,45 @@
+<?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="debug">
+
+  <appenders>
+    <Console name="STDOUT">
+      <PatternLayout pattern="%C{1.} %m %level MDC%X%n"/>
+    </Console>
+    <Jdbc name="databaseAppender" tableName="dmLogEntry">
+      <DriverManager url="jdbc:hsqldb:mem:Log4j;ifexists=true" username="sa" password=""
/>
+      <Column name="eventDate" isEventTimestamp="true" />
+      <Column name="literalColumn" literal="'Literal Value Test String'" />
+      <Column name="level" pattern="%level" />
+      <Column name="logger" pattern="%logger" />
+      <Column name="message" pattern="%message" />
+      <Column name="exception" pattern="%ex{full}" />
+    </Jdbc>
+  </appenders>
+
+  <loggers>
+    <logger name="org.apache.logging.log4j.core.appender.db" level="debug">
+      <appender-ref ref="databaseAppender" />
+    </logger>
+
+    <root level="error">
+      <appender-ref ref="STDOUT"/>
+    </root>
+  </loggers>
+
+</configuration>

Propchange: logging/log4j/log4j2/trunk/core/src/test/resources/org/apache/logging/log4j/core/appender/db/jdbc/log4j2-hsqldb-driver-manager.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: logging/log4j/log4j2/trunk/core/src/test/resources/org/apache/logging/log4j/core/appender/db/jdbc/log4j2-hsqldb-driver-manager.xml
------------------------------------------------------------------------------
    svn:keywords = Id

Copied: logging/log4j/log4j2/trunk/core/src/test/resources/org/apache/logging/log4j/core/appender/db/jdbc/log4j2-hsqldb-factory-method.xml
(from r1482645, logging/log4j/log4j2/trunk/core/src/test/resources/org/apache/logging/log4j/core/appender/db/jdbc/log4j2-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?p2=logging/log4j/log4j2/trunk/core/src/test/resources/org/apache/logging/log4j/core/appender/db/jdbc/log4j2-hsqldb-factory-method.xml&p1=logging/log4j/log4j2/trunk/core/src/test/resources/org/apache/logging/log4j/core/appender/db/jdbc/log4j2-factory-method.xml&r1=1482645&r2=1482660&rev=1482660&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/test/resources/org/apache/logging/log4j/core/appender/db/jdbc/log4j2-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
Wed May 15 02:23:46 2013
@@ -22,8 +22,8 @@
       <PatternLayout pattern="%C{1.} %m %level MDC%X%n"/>
     </Console>
     <Jdbc name="databaseAppender" tableName="fmLogEntry">
-      <ConnectionFactory class="org.apache.logging.log4j.core.appender.db.jdbc.JDBCAppenderTest"
-                               method="testFactoryMethodConfigMethod" />
+      <ConnectionFactory class="org.apache.logging.log4j.core.appender.db.jdbc.JdbcHyperSqlAppenderTest"
+         method="getConfigConnection" />
       <Column name="eventDate" isEventTimestamp="true" />
       <Column name="literalColumn" literal="'Some Other Literal Value'" />
       <Column name="level" pattern="%level" />



Mime
View raw message