Manish,

I have occasionally encountered this on Windows as well. It appears to be a bug 
in the logging
framework that we use - Logback.  There are a couple of JIRAs for Logback 
already, related to not
properly rolling over filenames. It's not clear to me yet what does or does not 
trigger it to avoid rolling.

What version of windows are you running on?

I did notice that most of the JIRA's deal with file size-based rolling. Have 
you tried rolling based only
on time:

    <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
      <fileNamePattern>logFile.%d{yyyy-MM-dd}.log</fileNamePattern>
      <maxHistory>30</maxHistory> 
      <totalSizeCap>3GB</totalSizeCap>
    </rollingPolicy>

I have not personally tried it and don't have access right now to a Windows 
machine, but it may be worth giving it a try.

Thanks
-Mark

> On Oct 4, 2016, at 11:57 PM, Manish Gupta 8 <[email protected]> wrote:
> 
> Hi Bryan,
>  
> I mean none of these files are getting rolled over. For APP_FILE, there are 
> no nifi-app_2016-10-04_01.log getting created (on hourly basis), and 
> everything goes into a single nifi-app.log file only. I tried changing it to 
> minute level, still it didn’t work. Also, I tried setting the log directory 
> to a hardcoded “logs” like it used to be in 0.3. Still, no success.
>  
> I am wondering if this could be because of running NiFi on windows.
>  
> Thanks,
> Manish
>  
> From: Bryan Bende [mailto:[email protected] <mailto:[email protected]>] 
> Sent: Wednesday, October 05, 2016 1:37 AM
> To: [email protected] <mailto:[email protected]>
> Subject: Re: Configure Logging - Rolling
>  
> Manish,
>  
> When you say everything is going into a single file, are you saying that 
> nifi-app.log, nifi-user.log, and nifi-bootstrap.log all never roll?
>  
> I just tested the nifi-app.log by running NiFi for over an hour and it rolled 
> exactly at 4pm and ended up with:
>  
> nifi-app.log
> nifi-app_2016-10-04_15.0.log
>  
> The current hour will always be in nifi-app.log.
>  
> The boostrap and user logs are set to roll per day, so you would have edit 
> their fileNamePattern to include %d{yyyy-MM-dd_HH}  rather than just %d  if 
> you wanted them to roll per hour.
>  
> -Bryan
>  
>  
> On Tue, Oct 4, 2016 at 10:12 AM, Manish Gupta 8 <[email protected] 
> <mailto:[email protected]>> wrote:
> Hi Bryan,
>  
> My app-log settings look as following, but the file is definitely not getting 
> created every hour. Everything is going into a single file only. And, this is 
> the default configuration.
> I am on 0.7.
>  
>     <appender name="APP_FILE" 
> class="ch.qos.logback.core.rolling.RollingFileAppender">
>         <file>${org.apache.nifi.bootstrap.config.log.dir}/nifi-app.log</file>
>         <rollingPolicy 
> class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
>             <!--
>               For daily rollover, use 'app_%d.log'.
>               For hourly rollover, use 'app_%d{yyyy-MM-dd_HH}.log'.
>               To GZIP rolled files, replace '.log' with '.log.gz'.
>               To ZIP rolled files, replace '.log' with '.log.zip'.
>             -->
>             
> <fileNamePattern>${org.apache.nifi.bootstrap.config.log.dir}/nifi-app_%d{yyyy-MM-dd_HH}.%i.log</fileNamePattern>
>             <timeBasedFileNamingAndTriggeringPolicy 
> class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
>                 <maxFileSize>100MB</maxFileSize>
>             </timeBasedFileNamingAndTriggeringPolicy>
>             <!-- keep 30 log files worth of history -->
>             <maxHistory>30</maxHistory>
>         </rollingPolicy>
>         <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
>             <pattern>%date %level [%thread] %logger{40} %msg%n</pattern>
>             <immediateFlush>true</immediateFlush>
>         </encoder>
>     </appender>
>  
>  
>  
>  
> Regards,
> Manish
>  
> From: Bryan Bende [mailto:[email protected] <mailto:[email protected]>] 
> Sent: Tuesday, October 04, 2016 7:35 PM
> To: [email protected] <mailto:[email protected]>
> Subject: Re: Configure Logging - Rolling
>  
> Hello,
>  
> I believe nifi-app.log is already doing hourly rollover with a max of 100mb 
> per file.
>  
> The logback.xml contains some comments that explain how to change it for 
> different rollovers:
> https://github.com/apache/nifi/blob/master/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-resources/src/main/resources/conf/logback.xml#L24-L30
>  
> <https://github.com/apache/nifi/blob/master/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-resources/src/main/resources/conf/logback.xml#L24-L30>
>  
> The nifi-bootstrap.log looks like it is set to daily because it only has %d 
> https://github.com/apache/nifi/blob/master/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-resources/src/main/resources/conf/logback.xml#L71
>  
> <https://github.com/apache/nifi/blob/master/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-resources/src/main/resources/conf/logback.xml#L71>
>  
> Thanks,
>  
> Bryan
>  
>  
> On Tue, Oct 4, 2016 at 9:57 AM, Manish Gupta 8 <[email protected] 
> <mailto:[email protected]>> wrote:
> Hi,
>  
> Is there any documentation/example for setting rolling app and bootstrap log 
> file. I want NiFi to create a new file every one hour. By default, everything 
> goes into a single file.
> I couldn’t find much about logback.xml in admin/dev guide.
>  
> Thanks,
> Manish

Reply via email to