ppkarwasz commented on issue #2144:
URL: 
https://github.com/apache/logging-log4j2/issues/2144#issuecomment-1873235561

   Hi @chrisribble,
   
   The dependencies on various annotation libraries **are** there, but they are 
in Maven's `provided` scope. This scope is the equivalent of Gradle's 
`compileOnly` configuration and is **not** transitive, so consumers of the 
artifacts don't get them automatically.
   
   This scope was chosen since these libraries contain only annotations (which 
cause no exception at runtime if missing) and most of them has a retention of 
`CLASS`, so they are visible only to the compiler. **Most** users don't need 
them, since accessing `log4j-core` programmatically is not recommended (it 
should be a `runtimeOnly` dependency).
   
   You can disable the compiler warnings with `-Xlint:all,-classFile`.
   
   May I ask why do you need to access 
`org.apache.logging.log4j.core.LoggerContext` in all your projects? Did you 
handle the case of users using another Log4j API implementation (e.g. 
`log4j-to-slf4j`)? Maybe this an opportunity to refactor your code and either 
put `log4j-core`-specific code in a separate library that will also handle 
other logging backends.


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to