[jboss-jira] [JBoss JIRA] (LOGMGR-68) periodic-rotating-file-handler not rotating

Paul V (JIRA) jira-events at lists.jboss.org
Fri Jun 7 13:40:54 EDT 2013


    [ https://issues.jboss.org/browse/LOGMGR-68?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12780295#comment-12780295 ] 

Paul V commented on LOGMGR-68:
------------------------------

Having the same problem JBoss 7.2.0 - Log Manager 1.4.0


The problem depends on the switch statement falling through the DAY and HALF_DAY cases and on the time being ( AM or PM ) of the parameter fromTime passed to the calcNextRollover method of PeriodicRotatingFileHandler.


private void calcNextRollover(final long fromTime) {
...
	switch (period) {
         ...
            case DAY:
                calendar.set(Calendar.HOUR_OF_DAY, 0); // set to 0 of the 24 hour clock
            case HALF_DAY:
                calendar.set(Calendar.HOUR, 0); // set to 0 (fromTime is AM) or 12 (fromTime  is PM) 
						// this resets Calendar.HOUR_OF_DAY TO 12 if fromTime is PM
         ...       
	}
...
}


This could be fixed by checking if the period variable is HALF_DAY otherwise it is unnecessary to set Calendar.HOUR


private void calcNextRollover(final long fromTime) {
...

	switch (period) {
         ...
            case DAY:
                calendar.set(Calendar.HOUR_OF_DAY, 0); // set to 0 of the 24 hour clock
            case HALF_DAY:
               if (period == Period.HALF_DAY)   // don't need to worry about setting Calendar.HOUR if Calendar.HOUR_OF_DAY was already set
                calendar.set(Calendar.HOUR, 0); // Calendar.HOUR will be properly set to 0 because of the previous call if we fell  
                                                // through the DAY case regardless of AM or PM
           …        
	}
...
}
                
> periodic-rotating-file-handler not rotating
> -------------------------------------------
>
>                 Key: LOGMGR-68
>                 URL: https://issues.jboss.org/browse/LOGMGR-68
>             Project: JBoss Log Manager
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>    Affects Versions: 1.4.0.Final
>         Environment: FreeBSD hostname 10.0-CURRENT FreeBSD 10.0-CURRENT #3 r242434M
>            Reporter: Alexander Yerenkow
>            Assignee: David Lloyd
>
> During day there could be few restarts of JBoss 7.2.0
> If there was one, next day logs aren't rotated.
> edb.log (contains record from 22 apr till now)
> edb.log.2013-04-12 (contains record from 06 apr till 12)
> edb.log.2013-04-17 (contains record from 13 apr till 17)
> edb.log.2013-04-19 (contains record from 18 apr till 19)
> Can't see clear system;
> Here's my config:
>             <periodic-rotating-file-handler name="EDB" autoflush="true">
>                 <formatter>
>                     <pattern-formatter pattern="%d %-5p [%c] (%t:%x) %s%E%n"/>
>                 </formatter>
>                 <file relative-to="jboss.server.log.dir" path="edb.log"/>
>                 <suffix value=".yyyy-MM-dd"/>
>                 <append value="true"/>
>             </periodic-rotating-file-handler>
> This all worked as charm in 7.1.1 / 7.1.3.
> Should I run some tests/ gather some info to fix this?

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira



More information about the jboss-jira mailing list