ppkarwasz commented on PR #2155:
URL: https://github.com/apache/zookeeper/pull/2155#issuecomment-2048289428

   > > The meaning is pretty much up to each developer to interpret. I 
interpret `provided` as "we don't bundle Logback, but you **need** it for 
Zookeeper to run". Regarding `optional` I interpret it as "some Zookeeper 
features only work with Logback" (a Logback appender maybe?).
   > 
   > Maven [actually 
defines](https://maven.apache.org/guides/introduction/introduction-to-optional-and-excludes-dependencies.html)
 the [meaning of 
these](https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html).
 I think your interpretation is pretty much correct, because it aligns with 
these definitions, but I don't think it's as subjective as you suggest. These 
definitions are what developers use to implement behavioral differences.
   
   Inside the Zookeeper project I agree: there are behavioral differences. But 
if Zookeeper is used as a dependency in another project, the differences fade.
   
   >> I think the message that should be sent to users is "Zookeeper 
prefers/recommends Logback, but it will work with whatever SLF4J implementation 
your provide him".
   >
   > I would say "happens to use" rather than "prefers/recommends", but yes, I 
think that message is basically the right message. But I think that message can 
be communicated with optional, and a basic understanding of Java logging 
frameworks.
   
   Yes, it makes sense. I might steal your interpretation and add an optional 
runtime dependency on Logback to `log4j-to-slf4j`, although the proposal to 
make Log4j Core an optional runtime dependency of `log4j-slf4j2-impl` in 
[LOG4J2-3601](https://issues.apache.org/jira/browse/LOG4J2-3601) was not met 
with a big applause. :stuck_out_tongue_winking_eye: [Disclaimer: I understand 
that these examples give the user only one serious choice of logging backend, 
while Zookeeper has two]
   
   > > Inside the Zookeeper project their usefulness is also somehow limited: 
the Maven Compiler and Surefire plugins will use them, but the Maven Assembly 
plugin will not package them in the `tar.gz` archive.
   > > So the only difference between runtime `optional` and `test` is that 
Logback is available at compilation time. This **is not** an advantage: if 
Zookeeper fails to compile without Logback, it means that it references some 
Logback-specific classes.
   > 
   > This is not true. There's actually no difference here. If it's marked 
optional alone, but still in the default "compile" scope, it will be available 
at compilation time. However, if it's marked "runtime", it is not available at 
compilation time... only test. That's why "optional" is frequently used in 
conjunction with "runtime" scope. So, there's actually no difference in 
behavior between these... it really just comes down to communicating intent.
   
   Sorry, I was thinking `compile optional`. Thanks for correcting me.
   
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@zookeeper.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to