This is an automated email from the ASF dual-hosted git repository. pkarwasz pushed a commit to branch feature/jul-to-log4j-api in repository https://gitbox.apache.org/repos/asf/logging-jdk.git
commit 1d9aa8dc1e3ac72c3c26fb2de7532a14967c5b79 Author: Piotr P. Karwasz <[email protected]> AuthorDate: Wed Nov 6 13:52:04 2024 +0100 Fix build --- jul-to-log4j-api/pom.xml | 85 ++++++++++++++++++++++++++++++------------------ parent/pom.xml | 68 +++++++++++++++++++++++++++++++++++++- pom.xml | 11 ++++++- spotbugs-exclude.xml | 37 +++++++++++++++++++++ 4 files changed, 167 insertions(+), 34 deletions(-) diff --git a/jul-to-log4j-api/pom.xml b/jul-to-log4j-api/pom.xml index 9e18420..02d8f8b 100644 --- a/jul-to-log4j-api/pom.xml +++ b/jul-to-log4j-api/pom.xml @@ -19,16 +19,23 @@ <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.apache.logging.log4j</groupId> - <artifactId>log4j</artifactId> + <artifactId>log4j-jdk-parent</artifactId> <version>${revision}</version> - <relativePath>../log4j-parent</relativePath> + <relativePath>../parent</relativePath> </parent> - <artifactId>jul-to-log4j</artifactId> - <name>Apache Log4j JUL LogManager</name> + <artifactId>jul-to-log4j-api</artifactId> + <name>JUL to Log4j API logging bridge</name> <description>A `java.util.logging` LogManager that forwards events to the Log4j API.</description> <properties> + <!-- Skips BND Baseline until the first release --> + <bnd.baseline.fail.on.missing>false</bnd.baseline.fail.on.missing> + + <!-- TODO: Adapt to Java 9 --> + <maven.compiler.release>17</maven.compiler.release> + <maven.compiler.source>${maven.compiler.release}</maven.compiler.source> + <maven.compiler.target>${maven.compiler.release}</maven.compiler.target> <!-- ~ OSGi and JPMS options --> @@ -40,6 +47,9 @@ <!-- Optional modules can not be `transitive` --> org.jspecify;transitive=false </bnd-extra-module-options> + + <!-- Dependency versions --> + <log4j.version>3.0.0-SNAPSHOT</log4j.version> </properties> <dependencies> @@ -60,18 +70,6 @@ <scope>test</scope> </dependency> - <dependency> - <groupId>org.hamcrest</groupId> - <artifactId>hamcrest</artifactId> - <scope>test</scope> - </dependency> - - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <scope>test</scope> - </dependency> - <dependency> <groupId>org.apache.logging.log4j</groupId> <artifactId>log4j-async-logger</artifactId> @@ -89,6 +87,7 @@ <artifactId>log4j-core-test</artifactId> <scope>test</scope> </dependency> + </dependencies> <build> @@ -96,22 +95,6 @@ <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> - <configuration> - <systemPropertyVariables> - <java.awt.headless>true</java.awt.headless> - </systemPropertyVariables> - <argLine>-Xms256m -Xmx1024m</argLine> - <forkCount>1</forkCount> - <reuseForks>false</reuseForks> - </configuration> - <dependencies> - <!-- The `surefire-junit-platform` provider initializes JUL before tests start --> - <dependency> - <groupId>org.apache.maven.surefire</groupId> - <artifactId>surefire-junit47</artifactId> - <version>${surefire.version}</version> - </dependency> - </dependencies> <executions> <execution> <id>default-test</id> @@ -120,12 +103,50 @@ </goals> <phase>test</phase> <configuration> + <excludes> + <exclude>**/AsyncLoggerThreadsTest.class</exclude> + <exclude>**/CustomLoggerAdapterTest.class</exclude> + </excludes> <!-- Use custom `j.u.l.LogManager` --> <systemPropertyVariables> <java.util.logging.manager>org.apache.logging.jul.tolog4j.LogManager</java.util.logging.manager> </systemPropertyVariables> </configuration> </execution> + <execution> + <id>async-logger-test</id> + <goals> + <goal>test</goal> + </goals> + <phase>test</phase> + <configuration> + <includes> + <include>**/AsyncLoggerThreadsTest.class</include> + </includes> + <!-- Use custom `j.u.l.LogManager` and an asynchronous selector --> + <systemPropertyVariables> + <java.util.logging.manager>org.apache.logging.jul.tolog4j.LogManager</java.util.logging.manager> + <log4j.loggerContext.selector>org.apache.logging.log4j.async.logger.AsyncLoggerContextSelector</log4j.loggerContext.selector> + </systemPropertyVariables> + </configuration> + </execution> + <execution> + <id>custom-logger-adapter-test</id> + <goals> + <goal>test</goal> + </goals> + <phase>test</phase> + <configuration> + <includes> + <include>**/CustomLoggerAdapterTest.class</include> + </includes> + <!-- Use custom `j.u.l.LogManager` and a custom adapter --> + <systemPropertyVariables> + <java.util.logging.manager>org.apache.logging.jul.tolog4j.LogManager</java.util.logging.manager> + <log4j.jul.loggerAdapter>org.apache.logging.jul.tolog4j.test.support.CustomLoggerAdapterTest$CustomLoggerAdapter</log4j.jul.loggerAdapter> + </systemPropertyVariables> + </configuration> + </execution> </executions> </plugin> </plugins> diff --git a/parent/pom.xml b/parent/pom.xml index b7a4e2d..f4a06c7 100644 --- a/parent/pom.xml +++ b/parent/pom.xml @@ -32,21 +32,87 @@ <properties> + <!-- Use a baseline of Java 9 --> + <maven.compiler.release>9</maven.compiler.release> + <maven.compiler.source>${maven.compiler.release}</maven.compiler.source> + <maven.compiler.target>${maven.compiler.release}</maven.compiler.target> + <!-- dependency versions --> + <assertj.version>3.26.3</assertj.version> + <bnd.annotation.version>7.0.0</bnd.annotation.version> + <hamcrest.version>2.2</hamcrest.version> + <jspecify.version>1.0.0</jspecify.version> + <junit.version>5.11.3</junit.version> <log4j.version>2.24.1</log4j.version> + <osgi.bundle.version>2.0.0</osgi.bundle.version> + <osgi.versioning.version>1.1.2</osgi.versioning.version> </properties> <dependencyManagement> <dependencies> + <dependency> + <groupId>org.hamcrest</groupId> + <artifactId>hamcrest</artifactId> + <version>${hamcrest.version}</version> + </dependency> + + <dependency> + <groupId>org.assertj</groupId> + <artifactId>assertj-bom</artifactId> + <version>${assertj.version}</version> + <type>pom</type> + <scope>import</scope> + </dependency> + <dependency> <groupId>org.apache.logging.log4j</groupId> - <artifactId>log4j-api</artifactId> + <artifactId>log4j-bom</artifactId> <version>${log4j.version}</version> + <type>pom</type> + <scope>import</scope> + </dependency> + + <dependency> + <groupId>org.junit</groupId> + <artifactId>junit-bom</artifactId> + <version>${junit.version}</version> + <type>pom</type> + <scope>import</scope> </dependency> </dependencies> </dependencyManagement> + <dependencies> + + <dependency> + <groupId>biz.aQute.bnd</groupId> + <artifactId>biz.aQute.bnd.annotation</artifactId> + <version>${bnd.annotation.version}</version> + <scope>provided</scope> + </dependency> + + <dependency> + <groupId>org.jspecify</groupId> + <artifactId>jspecify</artifactId> + <version>${jspecify.version}</version> + </dependency> + + <dependency> + <groupId>org.osgi</groupId> + <artifactId>org.osgi.annotation.bundle</artifactId> + <version>${osgi.bundle.version}</version> + <scope>provided</scope> + </dependency> + + <dependency> + <groupId>org.osgi</groupId> + <artifactId>org.osgi.annotation.versioning</artifactId> + <version>${osgi.versioning.version}</version> + </dependency> + + </dependencies> + </project> diff --git a/pom.xml b/pom.xml index ddca29e..2b0d1b7 100644 --- a/pom.xml +++ b/pom.xml @@ -59,6 +59,7 @@ <module>parent</module> <!-- Modules here must have a corresponding entry in `dependencyManagement > dependencies` block below! --> + <module>jul-to-log4j-api</module> </modules> @@ -97,7 +98,15 @@ <!-- `dependencyManagement` must only contain `jdk` modules and nothing else! Modules here must have a corresponding entry in `modules` block above! --> <dependencyManagement> - <dependencies /> + <dependencies> + + <dependency> + <groupId>org.apache.logging.log4j</groupId> + <artifactId>jul-to-log4j-api</artifactId> + <version>${project.version}</version> + </dependency> + + </dependencies> </dependencyManagement> <build> diff --git a/spotbugs-exclude.xml b/spotbugs-exclude.xml new file mode 100644 index 0000000..b0c83f0 --- /dev/null +++ b/spotbugs-exclude.xml @@ -0,0 +1,37 @@ +<?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. + --> +<FindBugsFilter + xmlns="https://github.com/spotbugs/filter/3.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="https://github.com/spotbugs/filter/3.0.0 https://raw.githubusercontent.com/spotbugs/spotbugs/3.1.0/spotbugs/etc/findbugsfilter.xsd"> + <Match> + <Not> + <Bug category="SECURITY"/> + </Not> + <Rank value="9"/> + </Match> + <Match> + <Or> + <!-- Spotbugs `4.8.4.0` introducing `SING_SINGLETON_GETTER_NOT_SYNCHRONIZED` contains a regression[1], disabling it. + [1] https://github.com/spotbugs/spotbugs/issues/2932 --> + <Bug pattern="SING_SINGLETON_GETTER_NOT_SYNCHRONIZED"/> + <!-- `SING_SINGLETON_HAS_NONPRIVATE_CONSTRUCTOR` check mostly generates noise, disabling it. --> + <Bug pattern="SING_SINGLETON_HAS_NONPRIVATE_CONSTRUCTOR"/> + </Or> + </Match> +</FindBugsFilter>
