logging-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject [2/6] logging-log4j2 git commit: [LOG4J2-2188] Split off JPA support into a new module log4j-jpa.
Date Sat, 27 Jan 2018 18:46:36 GMT
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/df10e02a/log4j-jpa/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/StackTraceElementAttributeConverterTest.java
----------------------------------------------------------------------
diff --git a/log4j-jpa/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/StackTraceElementAttributeConverterTest.java
b/log4j-jpa/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/StackTraceElementAttributeConverterTest.java
new file mode 100644
index 0000000..6da0d93
--- /dev/null
+++ b/log4j-jpa/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/StackTraceElementAttributeConverterTest.java
@@ -0,0 +1,132 @@
+/*
+ * 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.jpa.converter;
+
+import org.apache.logging.log4j.categories.Appenders;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import static org.junit.Assert.*;
+
+@Category(Appenders.Jpa.class)
+public class StackTraceElementAttributeConverterTest {
+    private StackTraceElementAttributeConverter converter;
+
+    @Before
+    public void setUp() {
+        this.converter = new StackTraceElementAttributeConverter();
+    }
+
+    @Test
+    public void testConvert01() {
+        final StackTraceElement element = new StackTraceElement("TestNoPackage", "testConvert01",
"TestNoPackage.java", 1234);
+
+        final String converted = this.converter.convertToDatabaseColumn(element);
+
+        assertNotNull("The converted value should not be null.", converted);
+        assertEquals("The converted value is not correct.", "TestNoPackage.testConvert01(TestNoPackage.java:1234)",
+                converted);
+
+        final StackTraceElement reversed = this.converter.convertToEntityAttribute(converted);
+
+        assertNotNull("The reversed value should not be null.", reversed);
+        assertEquals("The class name is not correct.", "TestNoPackage", reversed.getClassName());
+        assertEquals("The method name is not correct.", "testConvert01", reversed.getMethodName());
+        assertEquals("The file name is not correct.", "TestNoPackage.java", reversed.getFileName());
+        assertEquals("The line number is not correct.", 1234, reversed.getLineNumber());
+        assertFalse("The native flag should be false.", reversed.isNativeMethod());
+    }
+
+    @Test
+    public void testConvert02() {
+        final StackTraceElement element = new StackTraceElement("org.apache.logging.TestWithPackage",
+                "testConvert02", "TestWithPackage.java", -1);
+
+        final String converted = this.converter.convertToDatabaseColumn(element);
+
+        assertNotNull("The converted value should not be null.", converted);
+        assertEquals("The converted value is not correct.",
+                "org.apache.logging.TestWithPackage.testConvert02(TestWithPackage.java)",
+                converted);
+
+        final StackTraceElement reversed = this.converter.convertToEntityAttribute(converted);
+
+        assertNotNull("The reversed value should not be null.", reversed);
+        assertEquals("The class name is not correct.", "org.apache.logging.TestWithPackage",
reversed.getClassName());
+        assertEquals("The method name is not correct.", "testConvert02", reversed.getMethodName());
+        assertEquals("The file name is not correct.", "TestWithPackage.java", reversed.getFileName());
+        assertEquals("The line number is not correct.", -1, reversed.getLineNumber());
+        assertFalse("The native flag should be false.", reversed.isNativeMethod());
+    }
+
+    @Test
+    public void testConvert03() {
+        final StackTraceElement element = new StackTraceElement("org.apache.logging.TestNoSource",
+                "testConvert03", null, -1);
+
+        final String converted = this.converter.convertToDatabaseColumn(element);
+
+        assertNotNull("The converted value should not be null.", converted);
+        assertEquals("The converted value is not correct.",
+                "org.apache.logging.TestNoSource.testConvert03(Unknown Source)",
+                converted);
+
+        final StackTraceElement reversed = this.converter.convertToEntityAttribute(converted);
+
+        assertNotNull("The reversed value should not be null.", reversed);
+        assertEquals("The class name is not correct.", "org.apache.logging.TestNoSource",
reversed.getClassName());
+        assertEquals("The method name is not correct.", "testConvert03", reversed.getMethodName());
+        assertEquals("The file name is not correct.", null, reversed.getFileName());
+        assertEquals("The line number is not correct.", -1, reversed.getLineNumber());
+        assertFalse("The native flag should be false.", reversed.isNativeMethod());
+    }
+
+    @Test
+    public void testConvert04() {
+        final StackTraceElement element = new StackTraceElement("org.apache.logging.TestIsNativeMethod",
+                "testConvert04", null, -2);
+
+        final String converted = this.converter.convertToDatabaseColumn(element);
+
+        assertNotNull("The converted value should not be null.", converted);
+        assertEquals("The converted value is not correct.",
+                "org.apache.logging.TestIsNativeMethod.testConvert04(Native Method)",
+                converted);
+
+        final StackTraceElement reversed = this.converter.convertToEntityAttribute(converted);
+
+        assertNotNull("The reversed value should not be null.", reversed);
+        assertEquals("The class name is not correct.", "org.apache.logging.TestIsNativeMethod",
+                reversed.getClassName());
+        assertEquals("The method name is not correct.", "testConvert04", reversed.getMethodName());
+        assertEquals("The file name is not correct.", null, reversed.getFileName());
+        assertEquals("The line number is not correct.", -2, reversed.getLineNumber());
+        assertTrue("The native flag should be true.", reversed.isNativeMethod());
+    }
+
+    @Test
+    public void testConvertNullToDatabaseColumn() {
+        assertNull("The converted value should be null.", this.converter.convertToDatabaseColumn(null));
+    }
+
+    @Test
+    public void testConvertNullOrBlankToEntityAttribute() {
+        assertNull("The converted attribute should be null (1).", this.converter.convertToEntityAttribute(null));
+        assertNull("The converted attribute should be null (2).", this.converter.convertToEntityAttribute(""));
+    }
+}

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/df10e02a/log4j-jpa/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ThrowableAttributeConverterTest.java
----------------------------------------------------------------------
diff --git a/log4j-jpa/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ThrowableAttributeConverterTest.java
b/log4j-jpa/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ThrowableAttributeConverterTest.java
new file mode 100644
index 0000000..95deb6f
--- /dev/null
+++ b/log4j-jpa/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ThrowableAttributeConverterTest.java
@@ -0,0 +1,97 @@
+/*
+ * 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.jpa.converter;
+
+import java.sql.SQLException;
+
+import org.apache.logging.log4j.categories.Appenders;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import static org.junit.Assert.*;
+
+@Category(Appenders.Jpa.class)
+public class ThrowableAttributeConverterTest {
+    private ThrowableAttributeConverter converter;
+
+    @Before
+    public void setUp() {
+        this.converter = new ThrowableAttributeConverter();
+    }
+
+    @Test
+    public void testConvert01() {
+        final RuntimeException exception = new RuntimeException("My message 01.");
+
+        final String stackTrace = getStackTrace(exception);
+
+        final String converted = this.converter.convertToDatabaseColumn(exception);
+
+        assertNotNull("The converted value is not correct.", converted);
+        assertEquals("The converted value is not correct.", stackTrace, converted);
+
+        final Throwable reversed = this.converter.convertToEntityAttribute(converted);
+
+        assertNotNull("The reversed value should not be null.", reversed);
+        assertEquals("The reversed value is not correct.", stackTrace, getStackTrace(reversed));
+    }
+
+    @Test
+    public void testConvert02() {
+        final SQLException cause2 = new SQLException("This is a test cause.");
+        final Error cause1 = new Error(cause2);
+        final RuntimeException exception = new RuntimeException("My message 01.", cause1);
+
+        final String stackTrace = getStackTrace(exception);
+
+        final String converted = this.converter.convertToDatabaseColumn(exception);
+
+        assertNotNull("The converted value is not correct.", converted);
+        assertEquals("The converted value is not correct.", stackTrace, converted);
+
+        final Throwable reversed = this.converter.convertToEntityAttribute(converted);
+
+        assertNotNull("The reversed value should not be null.", reversed);
+        assertEquals("The reversed value is not correct.", stackTrace, getStackTrace(reversed));
+    }
+
+    @Test
+    public void testConvertNullToDatabaseColumn() {
+        assertNull("The converted value should be null.", this.converter.convertToDatabaseColumn(null));
+    }
+
+    @Test
+    public void testConvertNullOrBlankToEntityAttribute() {
+        assertNull("The converted attribute should be null (1).", this.converter.convertToEntityAttribute(null));
+        assertNull("The converted attribute should be null (2).", this.converter.convertToEntityAttribute(""));
+    }
+
+    private static String getStackTrace(final Throwable throwable) {
+        String returnValue = throwable.toString() + '\n';
+
+        for (final StackTraceElement element : throwable.getStackTrace()) {
+            returnValue += "\tat " + element.toString() + '\n';
+        }
+
+        if (throwable.getCause() != null) {
+            returnValue += "Caused by " + getStackTrace(throwable.getCause());
+        }
+
+        return returnValue;
+    }
+}

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/df10e02a/log4j-jpa/src/test/resources/META-INF/persistence.xml
----------------------------------------------------------------------
diff --git a/log4j-jpa/src/test/resources/META-INF/persistence.xml b/log4j-jpa/src/test/resources/META-INF/persistence.xml
new file mode 100644
index 0000000..c174abc
--- /dev/null
+++ b/log4j-jpa/src/test/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/df10e02a/log4j-jpa/src/test/resources/org/apache/logging/log4j/core/appender/db/jpa/log4j2-h2-jpa-base.xml
----------------------------------------------------------------------
diff --git a/log4j-jpa/src/test/resources/org/apache/logging/log4j/core/appender/db/jpa/log4j2-h2-jpa-base.xml
b/log4j-jpa/src/test/resources/org/apache/logging/log4j/core/appender/db/jpa/log4j2-h2-jpa-base.xml
new file mode 100644
index 0000000..ad22f65
--- /dev/null
+++ b/log4j-jpa/src/test/resources/org/apache/logging/log4j/core/appender/db/jpa/log4j2-h2-jpa-base.xml
@@ -0,0 +1,38 @@
+<?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="databaseAppender" persistenceUnitName="h2JpaAppenderTestUnit"
+         entityClassName="org.apache.logging.log4j.core.appender.db.jpa.TestBaseEntity" ignoreExceptions="false"
/>
+  </Appenders>
+
+  <Loggers>
+    <Logger name="org.apache.logging.log4j.core.appender.db" level="debug" additivity="false">
+      <AppenderRef ref="databaseAppender" />
+    </Logger>
+
+    <Root level="fatal">
+      <AppenderRef ref="STDOUT"/>
+    </Root>
+  </Loggers>
+
+</Configuration>

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/df10e02a/log4j-jpa/src/test/resources/org/apache/logging/log4j/core/appender/db/jpa/log4j2-h2-jpa-basic.xml
----------------------------------------------------------------------
diff --git a/log4j-jpa/src/test/resources/org/apache/logging/log4j/core/appender/db/jpa/log4j2-h2-jpa-basic.xml
b/log4j-jpa/src/test/resources/org/apache/logging/log4j/core/appender/db/jpa/log4j2-h2-jpa-basic.xml
new file mode 100644
index 0000000..af3a0b7
--- /dev/null
+++ b/log4j-jpa/src/test/resources/org/apache/logging/log4j/core/appender/db/jpa/log4j2-h2-jpa-basic.xml
@@ -0,0 +1,38 @@
+<?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="databaseAppender" persistenceUnitName="h2JpaAppenderTestUnit"
+         entityClassName="org.apache.logging.log4j.core.appender.db.jpa.TestBasicEntity"
ignoreExceptions="false" />
+  </Appenders>
+
+  <Loggers>
+    <Logger name="org.apache.logging.log4j.core.appender.db" level="debug" additivity="false">
+      <AppenderRef ref="databaseAppender" />
+    </Logger>
+
+    <Root level="fatal">
+      <AppenderRef ref="STDOUT"/>
+    </Root>
+  </Loggers>
+
+</Configuration>

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/df10e02a/log4j-jpa/src/test/resources/org/apache/logging/log4j/core/appender/db/jpa/log4j2-hsqldb-jpa-base.xml
----------------------------------------------------------------------
diff --git a/log4j-jpa/src/test/resources/org/apache/logging/log4j/core/appender/db/jpa/log4j2-hsqldb-jpa-base.xml
b/log4j-jpa/src/test/resources/org/apache/logging/log4j/core/appender/db/jpa/log4j2-hsqldb-jpa-base.xml
new file mode 100644
index 0000000..3f6e50a
--- /dev/null
+++ b/log4j-jpa/src/test/resources/org/apache/logging/log4j/core/appender/db/jpa/log4j2-hsqldb-jpa-base.xml
@@ -0,0 +1,38 @@
+<?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="databaseAppender" persistenceUnitName="hyperSqlJpaAppenderTestUnit"
+         entityClassName="org.apache.logging.log4j.core.appender.db.jpa.TestBaseEntity" ignoreExceptions="false"
/>
+  </Appenders>
+
+  <Loggers>
+    <Logger name="org.apache.logging.log4j.core.appender.db" level="debug" additivity="false">
+      <AppenderRef ref="databaseAppender" />
+    </Logger>
+
+    <Root level="fatal">
+      <AppenderRef ref="STDOUT"/>
+    </Root>
+  </Loggers>
+
+</Configuration>

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/df10e02a/log4j-jpa/src/test/resources/org/apache/logging/log4j/core/appender/db/jpa/log4j2-hsqldb-jpa-basic.xml
----------------------------------------------------------------------
diff --git a/log4j-jpa/src/test/resources/org/apache/logging/log4j/core/appender/db/jpa/log4j2-hsqldb-jpa-basic.xml
b/log4j-jpa/src/test/resources/org/apache/logging/log4j/core/appender/db/jpa/log4j2-hsqldb-jpa-basic.xml
new file mode 100644
index 0000000..8215ea3
--- /dev/null
+++ b/log4j-jpa/src/test/resources/org/apache/logging/log4j/core/appender/db/jpa/log4j2-hsqldb-jpa-basic.xml
@@ -0,0 +1,38 @@
+<?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="databaseAppender" persistenceUnitName="hyperSqlJpaAppenderTestUnit"
+         entityClassName="org.apache.logging.log4j.core.appender.db.jpa.TestBasicEntity"
ignoreExceptions="false" />
+  </Appenders>
+
+  <Loggers>
+    <Logger name="org.apache.logging.log4j.core.appender.db" level="debug" additivity="false">
+      <AppenderRef ref="databaseAppender" />
+    </Logger>
+
+    <Root level="fatal">
+      <AppenderRef ref="STDOUT"/>
+    </Root>
+  </Loggers>
+
+</Configuration>


Mime
View raw message