Coder Social home page Coder Social logo

slf4j-osgi's People

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

vlk32

slf4j-osgi's Issues

Update to LogService may disable logging/create memory leak for bundle in some instances

It's possible if a LogService bundle is swapped that in the typical usage of a slf4j logger, the logging for the class may stop working until the bundle is restarted. Below would be the example

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class MyClass {
  private Logger logger = LoggerFactory.getLogger(MyClass.class);

  public void doSomething() {
    logger.trace("MyClass.doSomething");
  }
}

As you can see, there's a single call to the LoggerFactory which will return the instance available at that point. Assuming there is a LogService available, the value will be initialized to the current OSGiLogger. If the LogService goes away an EmptyLogger will be set as the current Logger in the LogFactory, but that won't update the references to the OSGiLogger that all the classes which asked the LogFactory have. The original implementation that this one is based on always returned the same log factory and within that log factory handled the change.

To update this version, a similar mechanism should be used (ie, an OSGiLogger which is updated with the current service reference whenever it changes, and can handle having a null service reference. Alternatively some form of a proxy object could be returned and the object that proxy wraps could be updated as needed.

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.