Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
455 views
in Technique[技术] by (71.8m points)

logging - why my nifi can't split log into little part?

there is question on nifi 1.6.

I try to split log into small part with logback, but logback config seem not work.

Here is my config.

    <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">

            <fileNamePattern>${org.apache.nifi.bootstrap.config.log.dir}/daily/app_%d{yyyy-MM-dd}.%i.log</fileNamePattern>
            <maxFileSize>1MB</maxFileSize>
            <maxHistory>15</maxHistory>
        </rollingPolicy>
        <!--<immediateFlush>true</immediateFlush> -->
        <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
            <pattern>%date %level [%thread] %logger{40} %msg%n</pattern>
        </encoder>
    </appender>

and here is stdout in cmd

12:43:19,838 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Found resource [logback.xml] at [file:/D:/nifi-1.6.0-bin/nifi-1.6.0/conf/logback.xml]
12:43:19,893 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - debug attribute not set
12:43:19,899 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - Will scan for changes in [file:/D:/nifi-1.6.0-bin/nifi-1.6.0/conf/logback.xml]
12:43:19,899 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - Setting ReconfigureOnChangeTask scanning period to 30 seconds
12:43:19,901 |-INFO in ch.qos.logback.classic.joran.action.LoggerContextListenerAction - Adding LoggerContextListener of type [ch.qos.logback.classic.jul.LevelChangePropagator] to the object stack
12:43:19,909 |-INFO in ch.qos.logback.classic.jul.LevelChangePropagator@34ce8af7 - Propagating DEBUG level on Logger[ROOT] onto the JUL framework
12:43:19,909 |-INFO in ch.qos.logback.classic.joran.action.LoggerContextListenerAction - Starting LoggerContextListener
12:43:19,909 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.rolling.RollingFileAppender]
12:43:19,912 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [APP_FILE]
12:43:19,953 |-INFO in c.q.l.core.rolling.TimeBasedRollingPolicy@191382150 - No compression will be used
12:43:19,954 |-INFO in c.q.l.core.rolling.TimeBasedRollingPolicy@191382150 - Will use the pattern D:/nifi-1.6.0-bin/nifi-1.6.0/bin/..//logs/daily/app_%d{yyyy-MM-dd}.%i.log for the active file
12:43:19,956 |-INFO in ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP@880ec60 - The date pattern is 'yyyy-MM-dd' from file name pattern 'D:/nifi-1.6.0-bin/nifi-1.6.0/bin/..//logs/daily/app_%d{yyyy-MM-dd}.%i.log'.
12:43:19,956 |-INFO in ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP@880ec60 - Roll-over at midnight.
12:43:19,958 |-INFO in ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP@880ec60 - Setting initial period to Thu Jan 07 12:42:43 CST 2021
12:43:19,959 |-WARN in ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP@880ec60 - SizeAndTimeBasedFNATP is deprecated. Use SizeAndTimeBasedRollingPolicy instead
12:43:19,959 |-WARN in ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP@880ec60 - For more information see http://logback.qos.ch/manual/appenders.html#SizeAndTimeBasedRollingPolicy
12:43:19,978 |-INFO in ch.qos.logback.core.rolling.RollingFileAppender[APP_FILE] - Active log file name: D:
ifi-1.6.0-bin
ifi-1.6.0in..\logs/nifi-app.log
12:43:19,978 |-INFO in ch.qos.logback.core.rolling.RollingFileAppender[APP_FILE] - File property is set to [D:
ifi-1.6.0-bin
ifi-1.6.0in..\logs/nifi-app.log]

in log directory, when app.log is bigger than 1MB, daily directory is created, but no log file in there daily.

I wonder whether logback in nifi (or not for spring) can only split log by time?

same config in spring boot 2.x is working,in another words log can be split by size.

the logback version is 1.2.3.I try update logback config by using SizeAndTimeBasedRollingPolicy,same result i got.

):


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...