[logback-dev] Regarding logback help

Md. Hasan Basri pothiq at gmail.com
Thu May 17 12:38:54 CEST 2018


Dear Concern,

I'm a developer. One of my application is based on Jdk8, groovy 2.4 as
language and on the top of Spring Framework. As a logger I'm using
'logback' dependencies. (*group: 'ch.qos.logback', name: 'logback-classic',
version: '1.1.8'*). Basically, RollingFileAppender is working fine for me,
But currently.

For an example, Suppose the specific logger function is invoked at *2018-05-16
11:08:50*, A record entered into error.log and no rolling file is created.
Well, when the next execution occurs approximately after 6 minutes at
*2018-05-16
11:15:05*, A fresh file is created *error.2018-05-16-11-08.log* and
*error.log* file is refreshed with only the new message. This behavior is
as per the documentation. But currently, I'm in need of instant creation of
log file as soon as the rolling complete. In that case, the new file
*error.2018-05-16-11-08.log* which is created actually at *2018-05-16
11:15:05*, I need to create the same file actually at *2018-05-16
11:09:00* (means
as soon as the minute based rolling is complete).

<appender name="ERROR_LOG"
        class="ch.qos.logback.core.rolling.RollingFileAppender">
        <file>logs/error.log</file>
        <rollingPolicy
class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
            <fileNamePattern>logs/error_log/error.%d{yyyy-MM-dd-HH-mm}.log
            </fileNamePattern>
            <maxHistory>10</maxHistory>
        </rollingPolicy>
        <encoder>
            <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS}\t%msg%n</pattern>
        </encoder>
    </appender>

Through my investigation,
The purpose is partially resolved by removing the below property.

<file>logs/error.log</file>

But, I also need to produce "/logs/error.log" file. So, is there any way to
satisfy my first criteria without impacting error.log file.

Please, feel free to ask me anything regarding this issue.

Best Regards,

Md. Hasan Basri
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.qos.ch/pipermail/logback-dev/attachments/20180517/39d0c610/attachment-0001.html>


More information about the logback-dev mailing list