I may have missed something but is there a specific reason you can't use the date in the filename itself?<br><br>My only concern would be what happens if you don't log for a day, the first log will trigger a roll but the rolled file may be dated incorrectly? Anyway if that is the case you can use prudent (or something equivalent) which doesn't actually rename the files but writes to the actual target file with date and all.<br>
<br><div class="gmail_quote">On 1 July 2011 08:37, David Roussel <span dir="ltr"><<a href="mailto:nabble@diroussel.xsmail.com">nabble@diroussel.xsmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Well the log a special line at 00:01, to force the roll, then filter it out when you copy the log file for analysis.<br>
<br>
Alternatively have a look in the logback source code and work out where you can add a thread to force the rollover event.<br>
<font color="#888888"><br>
David<br>
</font><div><div></div><div class="h5"><br>
On 30 Jun 2011, at 10:57, Leon Rosenberg <<a href="mailto:rosenberg.leon@gmail.com">rosenberg.leon@gmail.com</a>> wrote:<br>
<br>
> On Thu, Jun 30, 2011 at 11:44 AM, David Roussel<br>
> <<a href="mailto:nabble@diroussel.xsmail.com">nabble@diroussel.xsmail.com</a>> wrote:<br>
>> What difference does the creation time of the log file make? Why is it important to you?<br>
>><br>
><br>
> Hello David,<br>
><br>
> we have a cron job that copies the work-results from last day aka log<br>
> file into a special data warehouse, where its analyzed by a bunch of<br>
> analysts ;-)<br>
> regards<br>
> Leon<br>
><br>
>> David<br>
>><br>
>> On 29 Jun 2011, at 17:17, Leon Rosenberg <<a href="mailto:rosenberg.leon@gmail.com">rosenberg.leon@gmail.com</a>> wrote:<br>
>><br>
>>> Thanx for the reply, David.<br>
>>> Is there another, less hackier way to do it?<br>
>>> The problem with 'log-a-message' approach, is that this log file only<br>
>>> contains events that really happened and is parsed and imported into<br>
>>> another reporting tool.<br>
>>> So if we start to log a message at 00:01, we have to force the people<br>
>>> who write the reporting tool to ignore this special message type etc.<br>
>>> I would prefer to keep things simpler, is there a possibility to force<br>
>>> logging behavior without actually logging something? Like a log.nop()?<br>
>>> ;-)<br>
>>><br>
>>> Another possibility we were thinking about was to have a cron job<br>
>>> performing touch on the logback.xml, which should also trigger<br>
>>> rolling. Or wouldn't it not?<br>
>>><br>
>>> Any other ideas?<br>
>>><br>
>>> thanx in advance<br>
>>> Leon<br>
>>><br>
>>> On Tue, Jun 28, 2011 at 3:33 PM, David Roussel<br>
>>> <<a href="mailto:nabble@diroussel.xsmail.com">nabble@diroussel.xsmail.com</a>> wrote:<br>
>>>> Yes it rolls on the first message. To force rolling, log a message.<br>
>>>><br>
>>>> On 28 Jun 2011, at 13:13, Leon Rosenberg <<a href="mailto:rosenberg.leon@gmail.com">rosenberg.leon@gmail.com</a>> wrote:<br>
>>>><br>
>>>>> Hello,<br>
>>>>><br>
>>>>> I have following logback rolling file appender configuration:<br>
>>>>><br>
>>>>><br>
>>>>> <appender name="DWHTextToolActionLogger"<br>
>>>>> class="ch.qos.logback.core.rolling.RollingFileAppender"><br>
>>>>> <file>${user.home}/data/inbound/csi/text_approval/xxx_text_approval.csv</file><br>
>>>>> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"><br>
>>>>> <fileNamePattern>${user.home}/data/inbound/csi/text_approval/xxx_text_approval_%d{yyyy_MM_dd}.csv.gz</fileNamePattern><br>
>>>>> <maxHistory>100</maxHistory><br>
>>>>> </rollingPolicy><br>
>>>>> <encoder><br>
>>>>> <pattern>%m%n</pattern><br>
>>>>> </encoder><br>
>>>>> </appender><br>
>>>>><br>
>>>>> <logger name="DWHTextToolActionLogger" additivity="false"><br>
>>>>> <level value="INFO" /><br>
>>>>> <appender-ref ref="DWHTextToolActionLogger" /><br>
>>>>> </logger><br>
>>>>><br>
>>>>> I would expect the log file to roll nightly, however, I only see<br>
>>>>> following files:<br>
>>>>><br>
>>>>><br>
>>>>> -rw-r--r-- 1 xxx xxx 236K Jun 28 14:08 xxx_text_approval.csv<br>
>>>>> -rw-r--r-- 1 xxx xxx 39K Jun 22 08:21 xxx_text_approval_2011_06_21.csv.gz<br>
>>>>> -rw-r--r-- 1 xxx xxx 32K Jun 23 08:18 xxx_text_approval_2011_06_22.csv.gz<br>
>>>>> -rw-r--r-- 1 xxx xxx 35K Jun 24 07:52 xxx_text_approval_2011_06_23.csv.gz<br>
>>>>> -rw-r--r-- 1 xxx xxx 26K Jun 25 07:43 xxx_text_approval_2011_06_24.csv.gz<br>
>>>>> -rw-r--r-- 1 xxx xxx 41K Jun 26 07:50 xxx_text_approval_2011_06_25.csv.gz<br>
>>>>> -rw-r--r-- 1 xxx xxx 28K Jun 27 07:44 xxx_text_approval_2011_06_26.csv.gz<br>
>>>>> -rw-r--r-- 1 xxx xxx 57K Jun 28 08:12 xxx_text_approval_2011_06_27.csv.gz<br>
>>>>><br>
>>>>> Is it misconfigured, or does the rolling actually happens at the first<br>
>>>>> log message in the morning?<br>
>>>>> If it's action based, how can i configure rolling to be triggered<br>
>>>>> @midnight no matter how empty or full the log is?<br>
>>>>><br>
>>>>> regards<br>
>>>>> Leon<br>
>>>>><br>
>>>>> p.s.<br>
>>>>> version:<br>
>>>>> <groupId>ch.qos.logback</groupId><br>
>>>>> <artifactId>logback-classic</artifactId><br>
>>>>> <version>0.9.28</version><br>
>>>>> _______________________________________________<br>
>>>>> Logback-user mailing list<br>
>>>>> <a href="mailto:Logback-user@qos.ch">Logback-user@qos.ch</a><br>
>>>>> <a href="http://qos.ch/mailman/listinfo/logback-user" target="_blank">http://qos.ch/mailman/listinfo/logback-user</a><br>
>>>> _______________________________________________<br>
>>>> Logback-user mailing list<br>
>>>> <a href="mailto:Logback-user@qos.ch">Logback-user@qos.ch</a><br>
>>>> <a href="http://qos.ch/mailman/listinfo/logback-user" target="_blank">http://qos.ch/mailman/listinfo/logback-user</a><br>
>>>><br>
>>> _______________________________________________<br>
>>> Logback-user mailing list<br>
>>> <a href="mailto:Logback-user@qos.ch">Logback-user@qos.ch</a><br>
>>> <a href="http://qos.ch/mailman/listinfo/logback-user" target="_blank">http://qos.ch/mailman/listinfo/logback-user</a><br>
>> _______________________________________________<br>
>> Logback-user mailing list<br>
>> <a href="mailto:Logback-user@qos.ch">Logback-user@qos.ch</a><br>
>> <a href="http://qos.ch/mailman/listinfo/logback-user" target="_blank">http://qos.ch/mailman/listinfo/logback-user</a><br>
>><br>
> _______________________________________________<br>
> Logback-user mailing list<br>
> <a href="mailto:Logback-user@qos.ch">Logback-user@qos.ch</a><br>
> <a href="http://qos.ch/mailman/listinfo/logback-user" target="_blank">http://qos.ch/mailman/listinfo/logback-user</a><br>
_______________________________________________<br>
Logback-user mailing list<br>
<a href="mailto:Logback-user@qos.ch">Logback-user@qos.ch</a><br>
<a href="http://qos.ch/mailman/listinfo/logback-user" target="_blank">http://qos.ch/mailman/listinfo/logback-user</a><br>
</div></div></blockquote></div><br>