On Mon, Jan 22, 2018 at 3:26 PM, Mikael Ståldal <mi...@apache.org> wrote:
> 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. > A big +1 from me on that one. The question is how to "manage that properly" as you say. ATM, the low-hanging fruit IMO is to make testing smarter and faster. > > 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. > Another +1 from me. Right now, the log4j-plugins repo Ralph keeps mentioning has all of two files in it: LICENSE and NOTICE; so it's not like we can move modules there and release today. My concern is that such a repo would indeed become a kind of dumping ground of a kitchen-sink. Kind of like those "Utils" class you find from time to time full of "stuff." And here I am with my log4j-mongodb3 module ready to be released. I could commit it and just have it activated by the other profile changes I have. Then Ralph can move whatever he wants in that profile. Gary > > 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 © >>>>>>>>>>> >>>>>>>>>> {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" >>>>>>>>>> >>>>>>>>>>