Giter VIP home page Giter VIP logo

Comments (5)

ceki avatar ceki commented on July 19, 2024

@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.

daniel-jasinski avatar daniel-jasinski commented on July 19, 2024

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.

ceki avatar ceki commented on July 19, 2024

@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.

daniel-jasinski avatar daniel-jasinski commented on July 19, 2024

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.

LanaLkv avatar LanaLkv commented on July 19, 2024

@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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.