Skip to content

Commit e553379

Browse files
committed
Update log4j-jul to Java 17
We update `log4j-jul` to: - implement methods introduced in Java 9, - remove methods deprecated in Java 9.
1 parent d372441 commit e553379

File tree

11 files changed

+486
-136
lines changed

11 files changed

+486
-136
lines changed

log4j-jul/pom.xml

Lines changed: 14 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -28,57 +28,48 @@
2828
<name>Apache Log4j JUL Adapter</name>
2929
<description>The Apache Log4j implementation of java.util.logging</description>
3030

31-
<properties>
32-
<log4jParentDir>${basedir}/..</log4jParentDir>
33-
34-
<!--
35-
~ OSGi and JPMS options
36-
-->
37-
<bnd-extra-package-options>
38-
<!-- Log4j Core is optional -->
39-
org.apache.logging.log4j.core.*;resolution:=optional
40-
</bnd-extra-package-options>
41-
42-
<!-- PTS requires using the JUnit Platform, which interferes with JUL initialization -->
43-
<predictive.test.selection.enabled>false</predictive.test.selection.enabled>
44-
</properties>
45-
4631
<dependencies>
32+
4733
<dependency>
4834
<groupId>org.apache.logging.log4j</groupId>
4935
<artifactId>log4j-api</artifactId>
5036
</dependency>
37+
5138
<dependency>
5239
<groupId>org.apache.logging.log4j</groupId>
53-
<artifactId>log4j-core</artifactId>
54-
<optional>true</optional>
40+
<artifactId>log4j-kit</artifactId>
5541
</dependency>
42+
5643
<dependency>
5744
<groupId>org.assertj</groupId>
5845
<artifactId>assertj-core</artifactId>
5946
<scope>test</scope>
6047
</dependency>
61-
<!-- Required for AsyncLogger testing -->
62-
<dependency>
63-
<groupId>com.lmax</groupId>
64-
<artifactId>disruptor</artifactId>
65-
<scope>test</scope>
66-
</dependency>
48+
6749
<dependency>
6850
<groupId>org.hamcrest</groupId>
6951
<artifactId>hamcrest</artifactId>
7052
<scope>test</scope>
7153
</dependency>
54+
7255
<dependency>
7356
<groupId>junit</groupId>
7457
<artifactId>junit</artifactId>
7558
<scope>test</scope>
7659
</dependency>
60+
7761
<dependency>
7862
<groupId>org.apache.logging.log4j</groupId>
7963
<artifactId>log4j-async-logger</artifactId>
8064
<scope>test</scope>
8165
</dependency>
66+
67+
<dependency>
68+
<groupId>org.apache.logging.log4j</groupId>
69+
<artifactId>log4j-core</artifactId>
70+
<scope>test</scope>
71+
</dependency>
72+
8273
<dependency>
8374
<groupId>org.apache.logging.log4j</groupId>
8475
<artifactId>log4j-core-test</artifactId>

log4j-jul/src/main/java/org/apache/logging/log4j/jul/AbstractLoggerAdapter.java

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,22 @@
2222
import org.apache.logging.log4j.util.StackLocatorUtil;
2323

2424
/**
25-
* Abstract Logger registry. Due to the optionality of using log4j-core, there are two registries available at runtime
26-
* to create: {@link ApiLoggerAdapter} and {@link CoreLoggerAdapter}.
25+
* Abstract Logger registry.
26+
* <p>
27+
* JUL contains methods, such as {@link Logger#setLevel}, which modify the configuration of the logging backend.
28+
* To fully implement all {@code Logger} methods, we need to provide a different {@code Logger} implementation
29+
* for each Log4j API implementation.
30+
* </p>
31+
* <p>
32+
* Older Log4j versions provided an alternative {@code CoreLoggerAdapter} implementation that supported
33+
* the modification of Log4j Core configuration using JUL.
34+
* </p>
35+
* Since version 2.24.0, however, this implementation was deprecated for removal.
36+
* If you wish to enable this feature again, you need to implement this class and provide its FQCN
37+
* as {@code log4j.jul.loggerAdapter} configuration property.
38+
* </p>
2739
*
40+
* @see <a href="https://github.com/apache/logging-log4j2/issues/2353">Issue #2353</a>
2841
* @since 2.1
2942
*/
3043
public abstract class AbstractLoggerAdapter extends org.apache.logging.log4j.spi.AbstractLoggerAdapter<Logger> {

0 commit comments

Comments
 (0)