1

I would like to have a log file that can be rolled at the beginning of the next day or if it's reached to specified file size. But my log file receives logging events from a remote appender.

My log.xml is:

<?xml version="1.0" encoding="UTF-8"?>

<configuration scan="true" scanPeriod="30 seconds">
    <property name="LOG_PORT" value="6000" />
    <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
        <file>${LOG_DIR}/logname.log</file>
        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
            <fileNamePattern>${LOG_DIR}/logname-%d{yyyy-MM-dd}.%i.zip</fileNamePattern>
            <maxHistory>30</maxHistory> 
            <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
                <maxFileSize>10MB</maxFileSize>
            </timeBasedFileNamingAndTriggeringPolicy>
        </rollingPolicy>
        <encoder>
            <pattern>%date{MMM dd yyyy HH:mm:ss.SSS}| [%thread] [%-5level] %logger{35}- %msg%n</pattern>
        </encoder>
    </appender>
    <receiver class="ch.qos.logback.classic.net.server.ServerSocketReceiver">
            <port>${myport}</port>
    </receiver>
    <root level="INFO">
            <appender-ref ref="FILE" />
    </root>

</configuration>

But with above configuration the log file is not rolled if the log file's size reached to 10 MB. So I wonder if Rolling policy still running for ServerSocketReceiver component.

Please help to advise me.

muistephen
  • 11
  • 1

0 Answers0