[ 
http://jira.qos.ch/browse/LBCORE-195?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=11962#action_11962
 ] 

Juergen Hermann commented on LBCORE-195:
----------------------------------------

This code is an intermediate fix:

package com.unitedinternet.portal.commons.logging.logback.rolling;

/**
 * Wrapper for TimeBasedRollingPolicy that fixes LBCORE-195.
 * 
 * @param <E> The logging event type.
 * 
 * @author jhe
 * @since 1.1
 */
public class TimeBasedRollingPolicy<E> extends
        ch.qos.logback.core.rolling.TimeBasedRollingPolicy<E> {

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


> TimeBasedRollingPolicy doesn't delegate life-cycle events
> ---------------------------------------------------------
>
>                 Key: LBCORE-195
>                 URL: http://jira.qos.ch/browse/LBCORE-195
>             Project: logback-core
>          Issue Type: Bug
>          Components: Rolling
>    Affects Versions: 0.9.27
>         Environment: Bug is also in the GIT head revision.
>            Reporter: Juergen Hermann
>            Assignee: Logback dev list
>
> 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
> {noformat}
>     /**
>      * {@inheritDoc}
>      */
>     @Override
>     public void stop() {
>         if (timeBasedFileNamingAndTriggeringPolicy != null) {
>             timeBasedFileNamingAndTriggeringPolicy.stop();
>         }
>         super.stop();
>     }
> {noformat}

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.qos.ch/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        
_______________________________________________
logback-dev mailing list
[email protected]
http://qos.ch/mailman/listinfo/logback-dev

Reply via email to