[ 
https://issues.apache.org/jira/browse/LOG4J2-3601?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17608234#comment-17608234
 ] 

Robbie Gemmell commented on LOG4J2-3601:
----------------------------------------

I came to report this, but am not surprised to see it was reported already.

I agree with the others that there is definitely a long held expectation that 
the log4j slf4j[2] bridge dep supply log4j-core. I think almost every user will 
be quite surprised if it doesnt, based both on it always being that way for 
log4j-slf4j-impl and log4jslf4j18-impl, and also it being expected to be a 
'Log4J -impl' rather than 'another Log4J -api, to use your own Log4J2 API 
implementation via SLF4J'.

I would note that similar to log4j-slf4j-impl before it, the module description 
is specifically "The Apache Log4j SLF4J 2.0 API binding to Log4j 2 Core":
https://github.com/apache/logging-log4j2/blob/rel/2.19.0/log4j-slf4j2-impl/pom.xml#L28

As has been said, the folks choosing to implement the Log4J2 API themselves 
rather than use log4j-core could clearly simply exclude a 'runtime' dependency 
on -core when also using this module. Or as also said its perhaps just as 
likely they'd also choose to implement the SLF4J API themselves rather than use 
the bridge module at all.

(Though not the same project or components, it was similarly the 
related-impl-is-provided way for the older SLF4J-maintained bridge deps for 
Log4J 1.x previously, i.e for most SLF4J and Log4J users of any version it has 
likely never been any other way until 2.19.0)

> log4j-slf4j2: change of dependency scope for log4j-core
> -------------------------------------------------------
>
>                 Key: LOG4J2-3601
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-3601
>             Project: Log4j 2
>          Issue Type: Improvement
>          Components: SLF4J Bridge
>    Affects Versions: 2.19.0
>            Reporter: Andy Seaborne
>            Priority: Major
>
> The artifact {{log4j-slf4j-impl}} has a scope=runtime dependency on 
> log4j-core. {{log4j-slf4j18-impl}} similarly had scope=runtime.
> The artifact {{log4j-slf4j2-impl}} has a scope=test dependency on log4j-core.
> This changed as part of [commit 
> 8f63620875|https://github.com/apache/logging-log4j2/pull/1024/files#diff-d3ba9956a9f81420d0be3d69477a05b505746272d548ab17404aa47f3e5946b0]
>  although it seems to be unrelated.
> It makes switching over more of a bump. Previously just depending on 
> {{log4j-slf4j-impl}} was enough.
> Please switch back to a scope=runtime dependency for {{log4j-slf4j2-impl}}.
> Example:  we (Apache Jena) use slf4j in the main code base, and select log4j 
> when it needed for binaries tests so we have multiple places where the 
> dependency happens. We can change - but this may be a user experience for 
> others as well.
> {noformat}
> [INFO] +- org.apache.logging.log4j:log4j-slf4j-impl:jar:2.18.0:compile
> [INFO] |  +- org.apache.logging.log4j:log4j-api:jar:2.18.0:compile
> [INFO] |  \- org.apache.logging.log4j:log4j-core:jar:2.18.0:runtime
> {noformat}
> {noformat}
> [INFO] +- org.apache.logging.log4j:log4j-slf4j2-impl:jar:2.19.0:compile
> [INFO] |  \- org.apache.logging.log4j:log4j-api:jar:2.19.0:compile
> {noformat}
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to