Uploaded image for project: 'logback'
  1. logback
  2. LOGBACK-669

Lifecycle stop() method is never called

    Details

    • Type: Bug
    • Status: In Progress
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      Don't know whether this is intended behavior, but when for example an configuration is loaded, the Lifecycle start() method is called. However, when the VM exits, stop() is never called. So anything in there is never executed. I came across this when writing a Google Charts appender for Perf4J.

        Activity

        Hide
        noreply.ceki@qos.ch Ceki Gulcu added a comment -

        Hello Lieven,

        What is the object type on which you would stop() to be called?

        Show
        noreply.ceki@qos.ch Ceki Gulcu added a comment - Hello Lieven, What is the object type on which you would stop() to be called?
        Hide
        rgoers@apache.org Ralph Goers added a comment -

        I happened to notice this as I was writing a routing appender similar to what we discussed in another Jira issue over the weekend. I was surprised to see that LoggerContext doesn't contain the list of configured appenders. It occurred to me that since appenders are started as they are created that if an appender is never referenced by a logger it will never be stopped. I would imagine this is fairly common since loggers are often commented out and then readded when more log output is desired.

        It also occurred to me that this means that if multiple loggers reference the same appender that the appender will be stopped when the first one stops its appenders even though it is still attached to multiple loggers. The consequence of this is that although logback is threadsafe during a reconfiguration the state of logging is unpredictable during that time.

        Show
        rgoers@apache.org Ralph Goers added a comment - I happened to notice this as I was writing a routing appender similar to what we discussed in another Jira issue over the weekend. I was surprised to see that LoggerContext doesn't contain the list of configured appenders. It occurred to me that since appenders are started as they are created that if an appender is never referenced by a logger it will never be stopped. I would imagine this is fairly common since loggers are often commented out and then readded when more log output is desired. It also occurred to me that this means that if multiple loggers reference the same appender that the appender will be stopped when the first one stops its appenders even though it is still attached to multiple loggers. The consequence of this is that although logback is threadsafe during a reconfiguration the state of logging is unpredictable during that time.

          People

          • Assignee:
            noreply.ceki@qos.ch Ceki Gulcu
            Reporter:
            lievendoclo Lieven Doclo
          • Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated: