[logback-user] problems with TimeBasedRollingPolicy

David Roussel nabble at diroussel.xsmail.com
Thu Jun 30 11:44:46 CEST 2011


What difference does the creation time of the log file make? Why is it important to you?

David

On 29 Jun 2011, at 17:17, Leon Rosenberg <rosenberg.leon at gmail.com> wrote:

> Thanx for the reply, David.
> Is there another, less hackier way to do it?
> The problem with 'log-a-message' approach, is that this log file only
> contains events that really happened and is parsed and imported into
> another reporting tool.
> So if we start to log a message at 00:01, we have to force the people
> who write the reporting tool to ignore this special message type etc.
> I would prefer to keep things simpler, is there a possibility to force
> logging behavior without actually logging something? Like a log.nop()?
> ;-)
> 
> Another possibility we were thinking about was to have a cron job
> performing touch on the logback.xml, which should also trigger
> rolling. Or wouldn't it not?
> 
> Any other ideas?
> 
> thanx in advance
> Leon
> 
> On Tue, Jun 28, 2011 at 3:33 PM, David Roussel
> <nabble at diroussel.xsmail.com> wrote:
>> Yes it rolls on the first message. To force rolling, log a message.
>> 
>> On 28 Jun 2011, at 13:13, Leon Rosenberg <rosenberg.leon at gmail.com> wrote:
>> 
>>> Hello,
>>> 
>>> I have following logback rolling file appender configuration:
>>> 
>>> 
>>>    <appender name="DWHTextToolActionLogger"
>>>        class="ch.qos.logback.core.rolling.RollingFileAppender">
>>>        <file>${user.home}/data/inbound/csi/text_approval/xxx_text_approval.csv</file>
>>>        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
>>>            <fileNamePattern>${user.home}/data/inbound/csi/text_approval/xxx_text_approval_%d{yyyy_MM_dd}.csv.gz</fileNamePattern>
>>>            <maxHistory>100</maxHistory>
>>>        </rollingPolicy>
>>>        <encoder>
>>>            <pattern>%m%n</pattern>
>>>        </encoder>
>>>    </appender>
>>> 
>>>    <logger name="DWHTextToolActionLogger" additivity="false">
>>>        <level value="INFO" />
>>>        <appender-ref ref="DWHTextToolActionLogger" />
>>>    </logger>
>>> 
>>> I would expect the log file to roll nightly, however, I only see
>>> following files:
>>> 
>>> 
>>> -rw-r--r-- 1 xxx xxx 236K Jun 28 14:08 xxx_text_approval.csv
>>> -rw-r--r-- 1 xxx xxx  39K Jun 22 08:21 xxx_text_approval_2011_06_21.csv.gz
>>> -rw-r--r-- 1 xxx xxx  32K Jun 23 08:18 xxx_text_approval_2011_06_22.csv.gz
>>> -rw-r--r-- 1 xxx xxx  35K Jun 24 07:52 xxx_text_approval_2011_06_23.csv.gz
>>> -rw-r--r-- 1 xxx xxx  26K Jun 25 07:43 xxx_text_approval_2011_06_24.csv.gz
>>> -rw-r--r-- 1 xxx xxx  41K Jun 26 07:50 xxx_text_approval_2011_06_25.csv.gz
>>> -rw-r--r-- 1 xxx xxx  28K Jun 27 07:44 xxx_text_approval_2011_06_26.csv.gz
>>> -rw-r--r-- 1 xxx xxx  57K Jun 28 08:12 xxx_text_approval_2011_06_27.csv.gz
>>> 
>>> Is it misconfigured, or does the rolling actually happens at the first
>>> log message in the morning?
>>> If it's action based, how can i configure rolling to be triggered
>>> @midnight no matter how empty or full the log is?
>>> 
>>> regards
>>> Leon
>>> 
>>> p.s.
>>> version:
>>>                             <groupId>ch.qos.logback</groupId>
>>>                                <artifactId>logback-classic</artifactId>
>>>                                <version>0.9.28</version>
>>> _______________________________________________
>>> Logback-user mailing list
>>> Logback-user at qos.ch
>>> http://qos.ch/mailman/listinfo/logback-user
>> _______________________________________________
>> Logback-user mailing list
>> Logback-user at qos.ch
>> http://qos.ch/mailman/listinfo/logback-user
>> 
> _______________________________________________
> Logback-user mailing list
> Logback-user at qos.ch
> http://qos.ch/mailman/listinfo/logback-user


More information about the Logback-user mailing list