Skip to content

Commit dff06e7

Browse files
committed
Restore compatibility of Log4j API
This restores backward compatibility of `log4j-api` from a user's perspective and adds comments to classes that should not have breaking changes. I have checked all the types in `org.apache.logging.log4j` and those reachable through inheritance or signature of public methods in other packages: ``` org.apache.logging.log4j.message.EntryMessage org.apache.logging.log4j.message.ExitMessage org.apache.logging.log4j.message.FlowMessage org.apache.logging.log4j.message.FlowMessageFactory org.apache.logging.log4j.message.Message org.apache.logging.log4j.message.MessageFactory org.apache.logging.log4j.spi.LoggerContext org.apache.logging.log4j.spi.ExtendedLogger org.apache.logging.log4j.spi.LoggerContextFactory org.apache.logging.log4j.spi.LoggerRegistry org.apache.logging.log4j.spi.StandardLevel org.apache.logging.log4j.spi.ReadOnlyThreadContextMap org.apache.logging.log4j.util.BiConsumer org.apache.logging.log4j.util.ReadOnlyStringMap org.apache.logging.log4j.util.StringMap org.apache.logging.log4j.util.StringBuilderFormattable org.apache.logging.log4j.util.Supplier org.apache.logging.log4j.util.TriConsumer ``` The only breaking changes I found are `Logger#entry/exit` and in `MarkerFactory`. I believe we should restore them and have a 100% binary compatibility with `2.x`, rather then breaking BC for almost nothing.
1 parent 96ddc3d commit dff06e7

22 files changed

+270
-61
lines changed

log4j-api/pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
<description>The Apache Log4j API</description>
3030
<properties>
3131
<maven.javadoc.skip>false</maven.javadoc.skip>
32+
<bnd.baseline.skip>false</bnd.baseline.skip>
3233

3334
<!--
3435
~ OSGi and JPMS options

log4j-api/src/main/java/org/apache/logging/log4j/Level.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
import static org.apache.logging.log4j.util.Strings.toRootUpperCase;
2020

21+
import aQute.bnd.annotation.baseline.BaselineIgnore;
2122
import java.util.Objects;
2223
import java.util.concurrent.ConcurrentHashMap;
2324
import java.util.concurrent.ConcurrentMap;
@@ -71,6 +72,7 @@
7172
* used in logging configurations.
7273
* </p>
7374
*/
75+
@BaselineIgnore("3.0.0")
7476
public final class Level implements Comparable<Level> {
7577

7678
private static final Level[] EMPTY_ARRAY = {};

log4j-api/src/main/java/org/apache/logging/log4j/LogManager.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,13 @@
4040
public class LogManager {
4141

4242
/**
43-
* Constant holding the name of the root logger (the empty string).
43+
* Kept for binary compatibility.
44+
*/
45+
@Deprecated(forRemoval = true)
46+
public static final String FACTORY_PROPERTY_NAME = "log4j2.loggerContextFactory";
47+
48+
/**
49+
* The name of the root Logger is {@value #ROOT_LOGGER_NAME}.
4450
*/
4551
public static final String ROOT_LOGGER_NAME = Strings.EMPTY;
4652

0 commit comments

Comments
 (0)