Comments (5)
@daniel-jasinski If you wish the provider to be loaded by your custom class loader, why don't you have org.slf4j.LoggerFactory
be loaded by your customer class loader or more generally have LoggerFactory
and the provider be reachable by the same class loader?
from slf4j.
In our setup only our classes are loaded by our classloader, third-party classes are loaded by standard class loaders. When those classes request the LoggerProvider, they cannot see our provider.
from slf4j.
@daniel-jasinski What is the parent child relationship between the various class loaders? What is the delegation model?
Also note that SLF4J was created in order to avoid the pitfalls of Jakarta Commons Logging in particular its class loader problems.
In any case, my previous comments stands.
from slf4j.
The relationship is similar to "child-first", we load "our" classes using our classloader and delegate all other classes to the parent.
The mechanism of SLF4J would work well if we were using one of the standard providers, but we are using a custom one that is loaded by our loader and all other classes (SLF4J and its other users) are loaded by the parent.
At the moment we have a bit of a workaround/hack. We analyzed which "non-our" classes use SL4FJ and we load them and all of the SLF$J classes using our loader. The code is very simple but conceptually it is ugly (to say the least) and not robust.
from slf4j.
@ceki in our use case, we would also highly appreciate the solution with context service loader in org.slf4j.LoggerFactory#findServiceProviders
This would allow us to use the slf4j 2.x in an OSGi environment.
from slf4j.
Related Issues (20)
- Don't log to `stderr` when `slf4j.provider` is used. HOT 14
- Make `slf4j.provider` constant public. HOT 3
- `slf4j-simple-impl` logging implementation artifact separate from its exposed service provider artifact. HOT 1
- DefaultLoggingEventBuilder/Log4jEventBuilder "addArgument" with supplier behaves same as constant value. HOT 1
- Can we log the message to stdout when there is no provider available? HOT 1
- The compatibility about 1.7.36 & 2.x HOT 3
- Apparently dead code in LoggerFactory HOT 3
- Add support for log level independent logging
- Fluent logging of primitive types HOT 3
- license url (in POM) pointing to the generic license instead of actual license
- [question] Log4j Version HOT 5
- Version 2.0.10 failed to execute mvn test
- [question] Checking for log4j vulnerabilities present in log4j-over-slf4j HOT 3
- No-op logger is not a sane default
- MDC Usage regression HOT 10
- [question] How do you pronounce SLF4J?
- Message formatting with last argument being Throwable
- Explicit provider fails when used with module system HOT 4
- Some links from FAQ document don't work. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from slf4j.