logging-log4j2 icon indicating copy to clipboard operation
logging-log4j2 copied to clipboard

log4j-slf4j[2]-impl: Misleading and unclear names/descriptions

Open Chealer opened this issue 2 years ago • 2 comments

Description

log4j-slf4j-impl has the following name and description:

<name>Apache Log4j SLF4J Binding</name>
description>The Apache Log4j SLF4J API binding to Log4j 2 Core</description>

log4j-slf4j2-impl has the following name and description:

<name>Apache Log4j SLF4J 2.0 Binding</name>
<description>The Apache Log4j SLF4J 2.0 API binding to Log4j 2 Core</description>

log4j-slf4j-impl's case is clearly misleading as it fails to indicate it (visibly) only supports SLF4J 1. log4j-slf4j2-impl's case is less bad, but also quite problematic:

  1. It mentions SLF4J 2.0 only, but future 2.x versions will (until proven otherwise) also be supported.
  2. It should be read as "The Apache Log4j ((SLF4J 2.0 API) binding to (Log4j 2 Core))", but could be read as "(The Apache Log4j SLF4J 2.0) ...". This ambiguity is understandable in the name, but considering that Log4j is itself a complex solution, and part of a ridiculously complicated Java logging ecosystem, a minimum has to be done to avoid that.
  3. Related to point #2, this does little to prevent confusion with the Apache Log4j to SLF4J Adapter.
  4. It uses the term "binding", while SLF4J 2 now prefers "provider".

Given all these considerations, I would suggest the following.

log4j-slf4j-impl:

<name>SLF4J 1 Binding for Log4j</name>
<description>
Simple Logging Facade for Java (SLF4J) version 1 API binding (provider) for Apache Log4j (version 2) core.
Allows using Log4j as an implementation of SLF4J.
</description>

log4j-slf4j2-impl:

<name>SLF4J 2 Provider for Log4j</name>
<description>
Simple Logging Facade for Java (SLF4J) version 2 provider (API binding) for Apache Log4j (version 2) core.
Allows using Log4j as an implementation of SLF4J.

This is not the Apache Log4j to SLF4J Adapter (log4j-to-slf4j).
</description>

Chealer avatar May 04 '23 18:05 Chealer

I have no problem with these recommendations. In fact, this really could have been created as a PR instead of an issue.

rgoers avatar May 07 '23 07:05 rgoers

I think that "SLF4J 2 Provider for Log4j" is rather ambiguous: is it a provider that forwards Log4j API calls to SLF4J (log4j-to-slf4j) or SLF4J calls to Log4j API (log4j-slf4j2-impl). Both APIs use the term "provider".

BTW: neither log4j-slf4j-impl nor log4j-slf4j2-impl bind SLF4J to Log4j Core. The binding is purely to Log4j API (cf. #1064 and related issue).

ppkarwasz avatar May 07 '23 07:05 ppkarwasz

Fixed in f37af11c0f5bab4264665230f0d9a7e2d46b8bdc (2.x) and d7917eb8ebefb8b47212c326a7de1300ccaa09e6 (main).

vy avatar Apr 25 '24 15:04 vy

Thank you @ppkarwasz and @vy The revised names and descriptions and much less misleading and clearer.

I suggested tweakings to descriptions via comments in d7917eb.

Chealer avatar Apr 27 '24 15:04 Chealer