You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2019/06/17 15:10:00 UTC

[jira] [Work logged] (LOG4J2-2403) Allow zero padding the counter of a RollingFileAppender

     [ https://issues.apache.org/jira/browse/LOG4J2-2403?focusedWorklogId=261430&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-261430 ]

ASF GitHub Bot logged work on LOG4J2-2403:
------------------------------------------

                Author: ASF GitHub Bot
            Created on: 17/Jun/19 15:09
            Start Date: 17/Jun/19 15:09
    Worklog Time Spent: 10m 
      Work Description: hupfdule commented on pull request #280: [LOG4J2-2403] Allow zero padding of integer values
URL: https://github.com/apache/logging-log4j2/pull/280
 
 
   Alternative to https://github.com/apache/logging-log4j2/pull/224 with less impact on other files.
   
   This alternative uses the the form `%i{03}` to specify the padding instead of `%03i` used in the orginal PR. 
   However this imposes an inconsistency with the justification that can already be specified and always uses spaces for padding as described in the [PatternLayout section of the Layout manual](https://logging.apache.org/log4j/2.x/manual/layouts.html#PatternLayout).
   
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Issue Time Tracking
-------------------

    Worklog Id:     (was: 261430)
    Time Spent: 40m  (was: 0.5h)

> Allow zero padding the counter of a RollingFileAppender
> -------------------------------------------------------
>
>                 Key: LOG4J2-2403
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-2403
>             Project: Log4j 2
>          Issue Type: Improvement
>          Components: Appenders
>    Affects Versions: 2.11.1
>            Reporter: Marco Herrn
>            Priority: Minor
>          Time Spent: 40m
>  Remaining Estimate: 0h
>
> 2It would be good if the filenamePattern for a RollingFileAppender would allow to zero pad the counter. Either automatically based on the max number of the counter or manually by giving the number of characters to pad to or even both approaches.
> For example the current sitution is this:
>   
>  {{filepattern="logs/mylog-%i.log"
>  DefaultRolloverStrategy max="15"}}
>   
>  The files I get will be:
> {{hh-10.log.gz
>  hh-11.log.gz
>  hh-12.log.gz
>  hh-13.log.gz
>  hh-14.log.gz
>  hh-15.log.gz 
>  hh-1.log.gz
>  hh-2.log.gz
>  hh-3.log.gz
>  hh-4.log.gz
>  hh-5.log.gz
>  hh-6.log.gz
>  hh-7.log.gz
>  hh-8.log.gz
>  hh-9.log.gz
>  hh.log}}
> This is very ugly in file listings. Therefore I propose two things:
> 1. Automatic padding based on the "max" parameter to the RolloverStrategy. If the max parameter has two digits (as in 15) it should automatically zero-pad the counter to be two digits as well.
> 2. Manual padding based on the filepattern pattern to the RollingFileAppender. At the moment it is possible to specify this as "%05i", but this does no zero-padding as expected, but instead pads with whitespaces. It should be possible to use zero-padding here too.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)