GitHub user Raphasha27 added a comment to the discussion: log4j 2 throws log4j
1 warnings
This happens when you have log4j 1.x API jars on the classpath alongside log4j
2.x. The `log4j-1.2-api` bridge is being triggered but the old API classes are
also present.
**Fix:** Find and remove old log4j 1.x jars, keeping only the 2.x bridge if
needed:
```bash
# Find conflicts
mvn dependency:tree -Dincludes=log4j
```
Look for:
- `log4j:log4j:1.2.x` — remove this (old log4j 1.x)
- Keep `org.apache.logging.log4j:log4j-1.2-api:2.x` (the bridge, only if you
have code using log4j 1.x API)
If you're using SLF4J, you don't need the bridge at all:
```xml
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j2-impl</artifactId>
<version>2.20.0</version>
</dependency>
```
**Exclude the transitive log4j 1.x dependency:**
```xml
<dependency>
<groupId>some.library</groupId>
<artifactId>some-artifact</artifactId>
<exclusions>
<exclusion>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
</exclusion>
</exclusions>
</dependency>
```
The warning is harmless but noisy — removing the old jar silences it entirely.
GitHub link:
https://github.com/apache/logging-log4j2/discussions/2003#discussioncomment-17347554
----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: [email protected]