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

TimeBasedRollingPolicy doesn't delegate life-cycle events

    XMLWordPrintable

Details

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • None
    • None
    • logback-core
    • None
    • Bug is also in the GIT head revision.

    Description

      In ch.qos.logback.core.rolling, both TimeBasedRollingPolicy and TimeBasedFileNamingAndTriggeringPolicy support the LifeCycle interface, and the former aggregates the latter.

      What TimeBasedRollingPolicy fails to do is to delegate the stop() event to its timeBasedFileNamingAndTriggeringPolicy object (it actually has no own stop() currently). This causes resource management problems in my use case, because my stop() is never called.

      Fix: Add this to ./logback-core/src/main/java/ch/qos/logback/core/rolling/TimeBasedRollingPolicy.java

          /**
           * {@inheritDoc}
           */
          @Override
          public void stop() {
              if (timeBasedFileNamingAndTriggeringPolicy != null) {
                  timeBasedFileNamingAndTriggeringPolicy.stop();
              }
              super.stop();
          }
      

      Attachments

        Activity

          People

            logback-dev Logback dev list
            jhermann Juergen Hermann
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: