Logback created files not visible in file manager sometimes. When I restart the device then it is visible

33 views Asked by At

I am using the below logback.xml file for logging logs. I have given the max size of 10 mb and max History of 14 days. My filename pattern include current IP Address of device and current date. After generating normal logs for somedays, sometimes logs files stop appearing in the file folder for two days. When I restarted my device on the third day, all files of the previous days becomes visible. What is wrong I am doing here.

<property name="log_path" value="/storage/emulated/0/Download/"/>

<appender name="Logcat"
    class="ch.qos.logback.classic.android.LogcatAppender">
    <triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
        <maxFileSize>10MB</maxFileSize>
    </triggeringPolicy>
    <encoder>
        <Pattern>%date %level %msg%n</Pattern>
    </encoder>

</appender>

<property name="format" value="@@YSUP-Mobile@@"/>
<timestamp key="timestamp" datePattern="yyyy-MM-dd" timeReference="contextBirth"/>

<appender name="File" class="ch.qos.logback.classic.sift.SiftingAppender">
    <discriminator>
        <key>IPAddress</key>
        <defaultValue>00.00.00.00</defaultValue>
    </discriminator>

    <sift>
        <appender name="internalFile" class="ch.qos.logback.core.rolling.RollingFileAppender">
            <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
                <fileNamePattern>${log_path}/InquiryLog/%d{yyyy-MM-dd}${format}${IPAddress}-%i.txt</fileNamePattern>
                <maxFileSize>10MB</maxFileSize>
                <maxHistory>14</maxHistory>
                <cleanHistoryOnStart> true </cleanHistoryOnStart>
            </rollingPolicy>
            <encoder>
                <pattern>%msg%n</pattern>
            </encoder>
        </appender>
    </sift>

</appender>


<root level="DEBUG">
    <appender-ref ref="Logcat" />
    <appender-ref ref="File"/>
</root>

I want to know the cause for this problem or any configuration which i did wrong in this.

0

There are 0 answers