I actually prefer to keep everything related to Log4j 2 (maybe except Chainsaw) in the same repository, if we can find a way to manage that properly.

But if we have to split it up as Ralph wants, we should do it properly and have one repository and release train per module (or closely related modules, mongodb and couchdb is not closely related in my world).

I think that having a kitchen-sink plugins repository collecting lots of unrelated plugins, and still having some "core" plugins in the main repo, would give us the worst from both worlds. Let's not go there.


On 2018-01-21 05:12, Remko Popma wrote:
Mikael, Ralph,

Have you really thought through the implications of having a separate
repository for each module? The overhead is very large!

It would mean:
* a separate website for each repo (our current Log4j2 website only knows
about the modules in the logging-log4j project).
* a separate release and release vote would need to be performed *for each
repo*. This process is so heavy that we only do it once a month for Log4j2.
Imagine doing this 10 times when we have 10 modules each in separate repos.
* synchronizing with the main Log4j project becomes checking and updating
10 projects instead of one.

All of these concerns already hold for a single log4j-plugins project, they
just multiply for each additional repo.

All,

Gary does have a point when he says we don’t have a clear plan for managing
the log4j-plugins repo. Who is going to check that the plugins still
compile after a Log4j2 release? Are we going to release a new plugins
version for each Log4j2 release? If not, when _will_ we release new
log4j-plugins versions?

Given our terrible track record for the log4j-tools project since we moved
TcpServer etc. into that repo (nobody showing interest to do the work to
release it), I agree these are valid concerns.

On the other hand, I also completely agree with Ralph that the build takes
much too long. Something needs to be done and Ralph is clearly signalling
he won't have this problem ignored any longer.

I'm not sure that moving things out of the main repo is the only solution
to make the build faster. If it really is the *only* solution, then fine.
But be mindful we are trading one problem for a set of new ones, and, just
like we can't ignore the slow build problem, we also cannot ignore the new
problems introduced by this solution (keeping the new repo(s) in sync,
building new web sites and linking them into the main site, release timing
etc).

PROPOSAL:
I think all of us should take responsibility for speeding up the build and
make it our first priority.
If you want to add anything to the main project, *first reduce the build
duration*. First find an existing test and speed it up. Only then add new
stuff, keeping the total build time to the same or less than it was
before.  Building core and running its tests used to take 8 minutes. Now it
takes 19:10 (`mvn clean package` on the whole project takes 24:22).

The core tests clearly are a major bottleneck.

Speeding up the core tests is something we can all work on. Can we split
the tests into a set that can be run multi-threaded in parallel (fastest),
a different set that does not require forking (fast) and a third set that
requires forking for every test (slowest)?

On the other hand, if we want to move things out of the main repo we need a
plan for the new repo(s). There is a one-time work of setting up web sites
and integrating them with the main site, but on an ongoing basis we need
some way to verify that a change in log4j-core did not break any plugins,
and agree to do a plugins release if it did break something.

Remko


On Sun, Jan 21, 2018 at 2:27 Ralph Goers <ralph.go...@dslextreme.com> wrote:

I am fine with doing that but we would still want a way to get to all the
plugin sites from the log4j web site. Maven does that and maintains a list
at https://maven.apache.org/plugins/ <https://maven.apache.org/plugins/>.
I think the easiest way to manage a page like that would to have it be a
separate page in the CMS that the log4j site links to.

Ralph

On Jan 20, 2018, at 8:29 AM, Mikael Ståldal <mi...@apache.org> wrote:

As I wrote recently, I don't think that having a kitchen-sink plugins
repository is a good way to solve this. Eventually that repository will get
too big.

It's better to create a new repository for each new module (or possibly
for a couple of related modules, but they should be more related than just
being Log4j plugins).


On 2018-01-19 06:31, Ralph Goers wrote:
Gary, I am complaining because I perform the releases. You never have.
We keep adding more and more crap to the build and it keeps taking longer
and longer. Af far as I am concerned that is a valid technical reason.
My -1 stands.
Ralph
On Jan 18, 2018, at 10:24 PM, Gary Gregory <garydgreg...@gmail.com>
wrote:

On Thu, Jan 18, 2018 at 10:20 PM, Ralph Goers <
ralph.go...@dslextreme.com>
wrote:

OK, but that doesn’t resolve the initial problem. The log4j 2 project
is
too large.


 From what I've experienced, folks complain about the size of the api
and
core jars, not the Maven project.

What is the target size/metric if it is currently "too large"? ;-)

Gary


Ralph

On Jan 18, 2018, at 10:15 PM, Gary Gregory <garydgreg...@gmail.com>
wrote:

On Thu, Jan 18, 2018 at 9:43 PM, Ralph Goers <
ralph.go...@dslextreme.com

wrote:

In addition, the build is now failing to compile on Jenkins.


Oops, please accept my apologies. I got caught by the Eclipse
compiler
being more forgiving (or more powerful) than the Oracle compiler in
the
generics department. All of that despite the Maven partial builds I
ran.
I
must have not run the clean goal or some-such.

Gary


Ralph

On Jan 18, 2018, at 9:28 PM, Ralph Goers <
ralph.go...@dslextreme.com>
wrote:

-1

Please revert and move this to the log4j plugins project.

Ralph

On Jan 18, 2018, at 8:54 PM, ggreg...@apache.org wrote:

Repository: logging-log4j2
Updated Branches:
refs/heads/master bb6fcd09e -> 639f093b8


[LOG4J2-2186] Add a JDBC ConnectionSource that provides pooling
through
Apache Commons DBCP 2.

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

Branch: refs/heads/master
Commit: 639f093b8103df2c2eda8d62fd12d7619d98ac04
Parents: bb6fcd0
Author: Gary Gregory <garydgreg...@gmail.com>
Authored: Thu Jan 18 20:54:47 2018 -0700
Committer: Gary Gregory <garydgreg...@gmail.com>
Committed: Thu Jan 18 20:54:47 2018 -0700

------------------------------------------------------------
----------
log4j-jdbc-dbcp2/pom.xml                        | 170
+++++++++++++++++++
.../db/jdbc/PoolingDriverConnectionSource.java  | 155
+++++++++++++++++
log4j-jdbc-dbcp2/src/site/manual/index.md       |  35 ++++
log4j-jdbc-dbcp2/src/site/site.xml              |  52 ++++++
.../jdbc/PoolingDriverConnectionSourceTest.java |  96 +++++++++++
pom.xml                                         |   1 +
src/changes/changes.xml                         |   3 +
src/site/xdoc/manual/appenders.xml              |  28 ++-
8 files changed, 537 insertions(+), 3 deletions(-)
------------------------------------------------------------
----------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/
639f093b/log4j-jdbc-dbcp2/pom.xml
------------------------------------------------------------
----------
diff --git a/log4j-jdbc-dbcp2/pom.xml b/log4j-jdbc-dbcp2/pom.xml
new file mode 100644
index 0000000..18e0e86
--- /dev/null
+++ b/log4j-jdbc-dbcp2/pom.xml
@@ -0,0 +1,170 @@
+<?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. -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"; xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance";
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
+  <parent>
+    <groupId>org.apache.logging.log4j</groupId>
+    <artifactId>log4j</artifactId>
+    <version>2.10.1-SNAPSHOT</version>
+  </parent>
+  <modelVersion>4.0.0</modelVersion>
+
+  <artifactId>log4j-jdbc-dbcp2</artifactId>
+  <name>Apache Log4j JDBC DBCP 2</name>
+  <description>
+    Connection source for the JDBC Appender using on Apache
Commons
DBCP 2.
+  </description>
+  <properties>
+    <log4jParentDir>${basedir}/..</log4jParentDir>
+    <docLabel>Log4j JDBC DBCP 2 Documentation</docLabel>
+    <projectDir>/log4j-jdbc-dbcp2</projectDir>
+    <module.name>org.apache.logging.log4j.jdbc.dbcp2</modu
le.name>
+  </properties>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.logging.log4j</groupId>
+      <artifactId>log4j-core</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.commons</groupId>
+      <artifactId>commons-dbcp2</artifactId>
+      <version>2.2.0</version>
+    </dependency>
+    <!-- Test Dependencies -->
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.logging.log4j</groupId>
+      <artifactId>log4j-api</artifactId>
+      <type>test-jar</type>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.logging.log4j</groupId>
+      <artifactId>log4j-core</artifactId>
+      <type>test-jar</type>
+    </dependency>
+    <dependency>
+      <groupId>com.h2database</groupId>
+      <artifactId>h2</artifactId>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.felix</groupId>
+        <artifactId>maven-bundle-plugin</artifactId>
+        <configuration>
+          <instructions>
+            <Fragment-Host>org.apache.
logging.log4j.core.appender.
db.jdbc</Fragment-Host>
+            <Export-Package>*</Export-Package>
+          </instructions>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+  <reporting>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-changes-plugin</artifactId>
+        <version>${changes.plugin.version}</version>
+        <reportSets>
+          <reportSet>
+            <reports>
+              <report>changes-report</report>
+            </reports>
+          </reportSet>
+        </reportSets>
+        <configuration>
+          <issueLinkTemplate>%URL%/show_bug.cgi?id=%ISSUE%</
issueLinkTemplate>
+          <useJql>true</useJql>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-checkstyle-plugin</artifactId>
+        <version>${checkstyle.plugin.version}</version>
+        <configuration>
+          <!--<propertiesLocation>${vfs.parent.dir}/checkstyle.
properties</propertiesLocation> -->
+          <configLocation>${log4jParentDir}/checkstyle.
xml</configLocation>
+          <suppressionsLocation>${log4jParentDir}/checkstyle-
suppressions.xml</suppressionsLocation>
+          <enableRulesSummary>false</enableRulesSummary>
+          <propertyExpansion>basedir=${
basedir}</propertyExpansion>
+          <propertyExpansion>licensedir=
${log4jParentDir}/checkstyle-
header.txt</propertyExpansion>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-javadoc-plugin</artifactId>
+        <version>${javadoc.plugin.version}</version>
+        <configuration>
+          <bottom><![CDATA[<p align="center">Copyright &#169;
{inceptionYear}-{currentYear} {organizationName}. All Rights
Reserved.<br />
+            Apache Logging, Apache Log4j, Log4j, Apache, the
Apache
feather logo, the Apache Logging project logo,
+            and the Apache Log4j logo are trademarks of The
Apache
Software Foundation.</p>]]></bottom>
+          <!-- module link generation is completely broken in the
javadoc plugin for a multi-module non-aggregating project -->
+          <detectOfflineLinks>false</detectOfflineLinks>
+          <linksource>true</linksource>
+        </configuration>
+        <reportSets>
+          <reportSet>
+            <id>non-aggregate</id>
+            <reports>
+              <report>javadoc</report>
+            </reports>
+          </reportSet>
+        </reportSets>
+      </plugin>
+      <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>findbugs-maven-plugin</artifactId>
+        <version>${findbugs.plugin.version}</version>
+        <configuration>
+          <fork>true</fork>
+          <jvmArgs>-Duser.language=en</jvmArgs>
+          <threshold>Normal</threshold>
+          <effort>Default</effort>
+          <excludeFilterFile>${log4jParentDir}/findbugs-
exclude-filter.xml</excludeFilterFile>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-jxr-plugin</artifactId>
+        <version>${jxr.plugin.version}</version>
+        <reportSets>
+          <reportSet>
+            <id>non-aggregate</id>
+            <reports>
+              <report>jxr</report>
+            </reports>
+          </reportSet>
+          <reportSet>
+            <id>aggregate</id>
+            <reports>
+              <report>aggregate</report>
+            </reports>
+          </reportSet>
+        </reportSets>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-pmd-plugin</artifactId>
+        <version>${pmd.plugin.version}</version>
+        <configuration>
+          <targetJdk>${maven.compiler.target}</targetJdk>
+        </configuration>
+      </plugin>
+    </plugins>
+  </reporting>
+</project>

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/
639f093b/log4j-jdbc-dbcp2/src/main/java/org/apache/logging/
log4j/core/appender/db/jdbc/PoolingDriverConnectionSource.java
------------------------------------------------------------
----------
diff --git a/log4j-jdbc-dbcp2/src/main/
java/org/apache/logging/log4j/
core/appender/db/jdbc/PoolingDriverConnectionSource.java
b/log4j-jdbc-dbcp2/src/main/java/org/apache/logging/log4j/
core/appender/db/jdbc/PoolingDriverConnectionSource.java
new file mode 100644
index 0000000..80adbb3
--- /dev/null
+++ b/log4j-jdbc-dbcp2/src/main/java/org/apache/logging/log4j/
core/appender/db/jdbc/PoolingDriverConnectionSource.java
@@ -0,0 +1,155 @@
+/*
+ * 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.DriverManager;
+import java.sql.SQLException;
+
+import org.apache.commons.dbcp2.ConnectionFactory;
+import org.apache.commons.dbcp2.DriverManagerConnectionFactory;
+import org.apache.commons.dbcp2.PoolableConnection;
+import org.apache.commons.dbcp2.PoolableConnectionFactory;
+import org.apache.commons.dbcp2.PoolingDriver;
+import org.apache.commons.pool2.ObjectPool;
+import org.apache.commons.pool2.impl.GenericObjectPool;
+import org.apache.logging.log4j.core.Core;
+import org.apache.logging.log4j.core.config.Property;
+import org.apache.logging.log4j.core.config.plugins.Plugin;
+import org.apache.logging.log4j.core.config.plugins.
PluginBuilderFactory;
+
+/**
+ * A {@link ConnectionSource} that uses a JDBC connection
string, a
user name, and a password to call
+ * {@link DriverManager#getConnection(String, String, String)}.
The
connections are served from an
+ * <a href="http://commons.apache.org/proper/commons-dbcp/";>
Apache
Commons DBCP</a> pooling driver.
+ */
+@Plugin(name = "PoolingDriver", category = Core.CATEGORY_NAME,
elementType = "connectionSource", printObject = true)
+public final class PoolingDriverConnectionSource extends
DriverManagerConnectionSource {
+
+    /**
+     * Builds PoolingDriverConnectionSource instances.
+     *
+     * @param <B>
+     *            This builder type or a subclass.
+     */
+    public static class Builder<B extends Builder<B>>
+            extends DriverManagerConnectionSource.Builder<B,
PoolingDriverConnectionSource> {
+
+        public static final String DEFAULT_POOL_NAME = "example";
+        private String poolName = DEFAULT_POOL_NAME;
+
+        @Override
+        public PoolingDriverConnectionSource build() {
+            try {
+                return new PoolingDriverConnectionSource(
getDriverClassName(),
getConnectionString(), getUserName(),
+                        getPassword(), getProperties(),
poolName);
+            } catch (final SQLException e) {
+                getLogger().error("Exception constructing {} for
{}",
PoolingDriverConnectionSource.class,
+                        getConnectionString(), e);
+                return null;
+            }
+        }
+
+        public B setPoolName(final String poolName) {
+            this.poolName = poolName;
+            return asBuilder();
+        }
+    }
+
+    public static final String URL_PREFIX =
"jdbc:apache:commons:dbcp:";
+
+    // This method is not named newBuilder() to make the compiler
happy.
+    @PluginBuilderFactory
+    public static <B extends Builder<B>> B
newPoolingDriverConnectionSourceBuilder() {
+        return new Builder<B>().asBuilder();
+    }
+
+    private final String poolingDriverClassName =
"org.apache.commons.dbcp2.PoolingDriver";
+
+    private final String poolName;
+
+    public PoolingDriverConnectionSource(final String
driverClassName, final String connectionString,
+            final char[] userName, final char[] password, final
Property[] properties, final String poolName)
+            throws SQLException {
+        super(driverClassName, connectionString, URL_PREFIX +
poolName, userName, password, properties);
+        this.poolName = poolName;
+        setupDriver(connectionString);
+    }
+
+    @Override
+    public String getActualConnectionString() {
+        // TODO Auto-generated method stub
+        return super.getActualConnectionString();
+    }
+
+    private PoolingDriver getPoolingDriver() throws SQLException
{
+        final PoolingDriver driver = (PoolingDriver)
DriverManager.getDriver(URL_PREFIX);
+        if (driver == null) {
+            getLogger().error("No JDBC driver for {}",
URL_PREFIX);
+        }
+        return driver;
+    }
+
+    private void setupDriver(final String connectionString)
throws
SQLException {
+        //
+        // First, we'll create a ConnectionFactory that the
+        // pool will use to create Connections.
+        // We'll use the DriverManagerConnectionFactory,
+        // using the connect string passed in the command line
+        // arguments.
+        //
+        final ConnectionFactory connectionFactory = new
DriverManagerConnectionFactory(connectionString, null);
+
+        //
+        // Next, we'll create the PoolableConnectionFactory,
which
wraps
+        // the "real" Connections created by the
ConnectionFactory
with
+        // the classes that implement the pooling functionality.
+        //
+        final PoolableConnectionFactory
poolableConnectionFactory =
new PoolableConnectionFactory(connectionFactory,
+                null);
+
+        //
+        // Now we'll need a ObjectPool that serves as the
+        // actual pool of connections.
+        //
+        // We'll use a GenericObjectPool instance, although
+        // any ObjectPool implementation will suffice.
+        //
+        @SuppressWarnings("resource")
+        // This GenericObjectPool will be closed on shutown
+        final ObjectPool<PoolableConnection> connectionPool = new
GenericObjectPool<>(poolableConnectionFactory);
+
+        // Set the factory's pool property to the owning pool
+        poolableConnectionFactory.setPool(connectionPool);
+
+        loadDriver(poolingDriverClassName);
+        final PoolingDriver driver = getPoolingDriver();
+        if (driver != null) {
+            driver.registerPool(poolName, connectionPool);
+        }
+        //
+        // Now we can just use the connect string
"jdbc:apache:commons:dbcp:example"
+        // to access our pool of Connections.
+        //
+    }
+
+    public void shutdownDriver() throws SQLException {
+        final PoolingDriver driver = getPoolingDriver();
+        if (driver != null) {
+            driver.closePool(poolName);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/
639f093b/log4j-jdbc-dbcp2/src/site/manual/index.md
------------------------------------------------------------
----------
diff --git a/log4j-jdbc-dbcp2/src/site/manual/index.md
b/log4j-jdbc-dbcp2/src/site/manual/index.md
new file mode 100644
index 0000000..b7fb5a5
--- /dev/null
+++ b/log4j-jdbc-dbcp2/src/site/manual/index.md
@@ -0,0 +1,35 @@
+<!-- vim: set syn=markdown : -->
+<!--
+    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.
+-->
+
+# Log4j 2 JDBC Connection Source with Apache Commons DBCP 2
+
+This module adds a connection source for JDBC Appenders. The
PoolingDriverConnectionSource
+provides connection pooling through Apache Commons DBCP 2.
+
+## Requirements
+
+This module was introduced in Log4j 2.11.0 and requires Apache
Commons
DBCP 2 to provide
+connection pooling.
+
+Some features may require optional
+[dependencies](../runtime-dependencies.html). These
dependencies are
specified in the
+documentation for those features.
+
+Some Log4j features require external dependencies.
+See the [Dependency Tree](dependencies.html#Dependency_Tree)
+for the exact list of JAR files needed for these features.

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/
639f093b/log4j-jdbc-dbcp2/src/site/site.xml
------------------------------------------------------------
----------
diff --git a/log4j-jdbc-dbcp2/src/site/site.xml
b/log4j-jdbc-dbcp2/src/site/site.xml
new file mode 100644
index 0000000..6d4cddc
--- /dev/null
+++ b/log4j-jdbc-dbcp2/src/site/site.xml
@@ -0,0 +1,52 @@
+<!--
+ 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.
+
+-->
+<project name="Log4j Core"
+         xmlns="http://maven.apache.org/DECORATION/1.4.0";
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+         xsi:schemaLocation="http://
maven.apache.org/DECORATION/1.
4.0
http://maven.apache.org/xsd/decoration-1.4.0.xsd";>
+  <body>
+    <links>
+      <item name="Apache" href="http://www.apache.org/"; />
+      <item name="Logging Services" href="http://logging.apache.
org/
"/>
+      <item name="Log4j" href="../index.html"/>
+    </links>
+
+    <!-- Component-specific reports -->
+    <menu ref="reports"/>
+
+    <!-- Overall Project Info -->
+    <menu name="Log4j Project Information" img="icon-info-sign">
+      <item name="Dependencies" href="../dependencies.html" />
+      <item name="Dependency Convergence" href="../dependency-
convergence.html"
/>
+      <item name="Dependency Management" href="../dependency-
management.html"
/>
+      <item name="Project Team" href="../team-list.html" />
+      <item name="Mailing Lists" href="../mail-lists.html" />
+      <item name="Issue Tracking" href="../issue-tracking.html"
/>
+      <item name="Project License" href="../license.html" />
+      <item name="Source Repository" href="../source-repository.
html"
/>
+      <item name="Project Summary"
href="../project-summary.html" />
+    </menu>
+
+    <menu name="Log4j Project Reports" img="icon-cog">
+      <item name="Changes Report" href="../changes-report.html"
/>
+      <item name="JIRA Report" href="../jira-report.html" />
+      <item name="Surefire Report"
href="../surefire-report.html" />
+      <item name="RAT Report" href="../rat-report.html" />
+    </menu>
+  </body>
+</project>

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/
639f093b/log4j-jdbc-dbcp2/src/test/java/org/apache/logging/
log4j/core/appender/db/jdbc/PoolingDriverConnectionSourceTest.java
------------------------------------------------------------
----------
diff --git a/log4j-jdbc-dbcp2/src/test/
java/org/apache/logging/log4j/
core/appender/db/jdbc/PoolingDriverConnectionSourceTest.java
b/log4j-jdbc-dbcp2/src/test/java/org/apache/logging/log4j/
core/appender/db/jdbc/PoolingDriverConnectionSourceTest.java
new file mode 100644
index 0000000..2b7b886
--- /dev/null
+++ b/log4j-jdbc-dbcp2/src/test/java/org/apache/logging/log4j/
core/appender/db/jdbc/PoolingDriverConnectionSourceTest.java
@@ -0,0 +1,96 @@
+/*
+ * 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.SQLException;
+
+import org.apache.logging.log4j.core.config.Property;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class PoolingDriverConnectionSourceTest {
+
+    @Test
+    public void testH2Properties() throws SQLException {
+        final Property[] properties = new Property[] {
+                // @formatter:off
+                Property.createProperty("username",
JdbcH2TestHelper.USER_NAME),
+                Property.createProperty("password",
JdbcH2TestHelper.PASSWORD),
+                // @formatter:on
+        };
+        // @formatter:off
+        final PoolingDriverConnectionSource source =
PoolingDriverConnectionSource.newPoolingDriverConnectionSour
ceBuilder()
+            .setConnectionString(JdbcH2TestHelper.CONNECTION_
STRING)
+            .setProperties(properties)
+            .build();
+        // @formatter:on
+        try (Connection conn = source.getConnection()) {
+            Assert.assertFalse(conn.isClosed());
+        }
+    }
+
+    @Test
+    public void testH2PropertiesAndPoolName() throws
SQLException {
+        final Property[] properties = new Property[] {
+                // @formatter:off
+                Property.createProperty("username",
JdbcH2TestHelper.USER_NAME),
+                Property.createProperty("password",
JdbcH2TestHelper.PASSWORD),
+                // @formatter:on
+        };
+        // @formatter:off
+        final PoolingDriverConnectionSource source =
PoolingDriverConnectionSource.newPoolingDriverConnectionSour
ceBuilder()
+            .setConnectionString(JdbcH2TestHelper.CONNECTION_
STRING)
+            .setProperties(properties)
+            .setPoolName("MyPoolName")
+            .build();
+        // @formatter:on
+        try (Connection conn = source.getConnection()) {
+            Assert.assertFalse(conn.isClosed());
+        }
+    }
+
+    @Test
+    public void testH2UserAndPassword() throws SQLException {
+        // @formatter:off
+        final PoolingDriverConnectionSource source =
PoolingDriverConnectionSource.newPoolingDriverConnectionSour
ceBuilder()
+            .setConnectionString(JdbcH2TestHelper.CONNECTION_
STRING)
+            .setUserName(JdbcH2TestHelper.
USER_NAME.toCharArray())
+            .setPassword(JdbcH2TestHelper.
PASSWORD.toCharArray())
+            .build();
+        // @formatter:on
+        try (Connection conn = source.getConnection()) {
+            Assert.assertFalse(conn.isClosed());
+        }
+    }
+
+    @Test
+    public void testH2UserPasswordAndPoolName() throws
SQLException
{
+        // @formatter:off
+        final PoolingDriverConnectionSource source =
PoolingDriverConnectionSource.newPoolingDriverConnectionSour
ceBuilder()
+            .setConnectionString(JdbcH2TestHelper.CONNECTION_
STRING)
+            .setUserName(JdbcH2TestHelper.
USER_NAME.toCharArray())
+            .setPassword(JdbcH2TestHelper.
PASSWORD.toCharArray())
+            .setPoolName("MyPoolName")
+            .build();
+        // @formatter:on
+        try (Connection conn = source.getConnection()) {
+            Assert.assertFalse(conn.isClosed());
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/
639f093b/pom.xml
------------------------------------------------------------
----------
diff --git a/pom.xml b/pom.xml
index 31195f2..f1027f2 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1320,6 +1320,7 @@
  <module>log4j-jmx-gui</module>
  <module>log4j-samples</module>
  <module>log4j-bom</module>
+    <module>log4j-jdbc-dbcp2</module>
  <module>log4j-couchdb</module>
  <module>log4j-mongodb</module>
  <module>log4j-cassandra</module>

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/
639f093b/src/changes/changes.xml
------------------------------------------------------------
----------
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 3ca94e4..6398bb0 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -104,6 +104,9 @@
    <action issue="LOG4J2-2198" dev="ggregory" type="update">
      Update MongoDB dependencies from classic to modern.
    </action>
+      <action issue="LOG4J2-2186" dev="ggregory" type="add">
+        Add a JDBC ConnectionSource that provides pooling through
Apache Commons DBCP 2.
+      </action>
  </release>
  <release version="2.10.0" date="2017-11-18" description="GA
Release
2.10.0">
    <action issue="LOG4J2-2120" dev="mikes" type="add"
due-to="Carter
Douglas Kozak ">

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/
639f093b/src/site/xdoc/manual/appenders.xml
------------------------------------------------------------
----------
diff --git a/src/site/xdoc/manual/appenders.xml
b/src/site/xdoc/manual/
appenders.xml
index c62a284..4f106df 100644
--- a/src/site/xdoc/manual/appenders.xml
+++ b/src/site/xdoc/manual/appenders.xml
@@ -1070,9 +1070,10 @@ CREATE TABLE logs (
        <p>When configuring the JDBCAppender, you must specify a
<code>ConnectionSource</code> implementation from
          which the Appender gets JDBC connections. You must use
exactly one of the following nested elements:</p>
        <ul>
-            <li><a href="#JDBCDataSource"><code>&
lt;DataSource&gt;</code></a></li>
-            <li><a href="#JDBCConnectionFactory">
<code>&lt;ConnectionFactory&gt;</code></a></li>
-            <li><a href="#JDBCDriverManager"><
code>&lt;DriverManager&gt;</code></a></li>
+            <li><a href="#JDBCDataSource"><code>&
lt;DataSource&gt;</code></a>:
Uses JNDI.</li>
+            <li><a href="#JDBCConnectionFactory">
<code>&lt;ConnectionFactory&gt;</code></a>: Points to a
class-method
pair
to provide JDBC connections.</li>
+            <li><a href="#JDBCDriverManager"><
code>&lt;DriverManager&gt;</code></a>: A quick and dirty way to
get off
the ground, no connection pooling.</li>
+            <li><a href="#JDBCPoolingDriver"><
code>&lt;PoolingDriver&gt;</code></a>: Uses Apache Commons DBCP to
provide connection pooling.</li>
        </ul>
        <a name="JDBCDataSource"/>
        <table>
@@ -1149,6 +1150,27 @@ CREATE TABLE logs (
            <td>A list of properties. You cannot specify both
properties and a user name or password.</td>
          </tr>
        </table>
+          <a name="JDBCPoolingDriver"/>
+          <table>
+            <caption align="top">PoolingDriver Parameters (Apache
Commons DBCP)</caption>
+            <tr>
+              <th>Parameter Name</th>
+              <th>Type</th>
+              <th>Description</th>
+            </tr>
+            <tr>
+              <td>DriverManager parameters</td>
+              <td>DriverManager parameters</td>
+              <td>This connection source inherits all parameter
from
the DriverManager connection source.</td>
+            </tr>
+            <tr>
+              <td>poolName</td>
+              <td>String</td>
+              <td>The pool name used to pool JDBC Connections.
Defaults to <code>example</code>. You can use the JDBC
+              connection string prefix <code>jdbc:apache:commons:
dbcp:</code>
followed by the pool name if you want
+              to use a pooled connection elsewhere. For example:
<code>jdbc:apache:commons:dbcp:example</code>.</td>
+            </tr>
+          </table>
        <p>When configuring the JDBCAppender, use the nested
<code>&lt;Column&gt;</code> elements to specify which
          columns in the table should be written to and how to
write
to them. The JDBCAppender uses this information
          to formulate a <code>PreparedStatement</code> to insert
records without SQL injection vulnerability.</p>



















Reply via email to