[logback-user] Logback Rolling policy issue.

Troy Hart troy.hart at gmail.com
Fri Mar 7 19:38:36 CET 2014


Another issue--the one responsible for the exception posted:

<fileNamePattern>C:/Logs/someInfoLog.log.%d{'.'yyyy-MM-dd}</fileNamePattern>

Should probably be:

<fileNamePattern>C:/Logs/someInfoLog.log.%d{yyyy-MM-dd}</fileNamePattern>


Sorry to say this, but the sample you posted is very sloppy. I would
suggest you clean it up simplify it until you get straight on how to
configure the rolling policy. It works great for me. Here is a sample of
one of my appender definitions which works flawlessly:

<appender name="default"
class="ch.qos.logback.core.rolling.RollingFileAppender">
    <append>true</append>
    <file>${logging.log_dir}/${contextName}.log</file>
    <rollingPolicy
class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
      <cleanHistoryOnStart>true</cleanHistoryOnStart>
      <maxHistory>${logging.appender_max_file_history:-1}</maxHistory>

<fileNamePattern>${logging.log_archive_dir}/${contextName}.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern>
      <timeBasedFileNamingAndTriggeringPolicy
class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
        <maxFileSize>${logging.appender_max_file_size}</maxFileSize>
      </timeBasedFileNamingAndTriggeringPolicy>
    </rollingPolicy>
    <encoder class="${logging.encoder.default}" />
  </appender>


On Fri, Mar 7, 2014 at 11:07 AM, Chandraprakash <
chandraprakash.kalwar at gmail.com> wrote:

> Dear Troy, Thanks for your reply. I have made the changes and will test it
> now. Still I have two doubts: 1. why files are '.tmp' when I have provide
> '.zip' extension? 2. Why log file size is limited to around 20 MB, wherever
> I have given limit to 25 MB? [image: generated logs]
> ------------------------------
> View this message in context: Re: Logback Rolling policy issue.<http://logback.10977.n7.nabble.com/Logback-Rolling-policy-issue-tp13350p13352.html>
> Sent from the Users mailing list archive<http://logback.10977.n7.nabble.com/Users-f3.html>at Nabble.com.
>
> _______________________________________________
> Logback-user mailing list
> Logback-user at qos.ch
> http://mailman.qos.ch/mailman/listinfo/logback-user
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.qos.ch/pipermail/logback-user/attachments/20140307/5348e818/attachment.html>


More information about the Logback-user mailing list