Warn about broken auto-archiving settings (#522)

* Warn about broken settings

* Apply suggestions from code review

Co-Authored-By: Oleg Nenashev <o.v.nenashev@gmail.com>

* Apply suggestions from code review

Co-authored-by: Oleg Nenashev <o.v.nenashev@gmail.com>
pull/524/head
Next Turn 2020-04-23 05:08:54 +08:00 committed by GitHub
parent 1454e3ca36
commit 5881e8eccd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 2 deletions

View File

@ -67,8 +67,6 @@ Works in a combination of rotate size mode and rotate time mode, if the log file
<sizeThreshold>10240</sizeThreshold> <sizeThreshold>10240</sizeThreshold>
<pattern>yyyyMMdd</pattern> <pattern>yyyyMMdd</pattern>
<autoRollAtTime>00:00:00</autoRollAtTime> <autoRollAtTime>00:00:00</autoRollAtTime>
<zipOlderThanNumDays>5</zipOlderThanNumDays>
<zipDateFormat>yyyyMM</zipDateFormat>
</log> </log>
``` ```
@ -78,6 +76,19 @@ For example, in the above example, the log of Jan 1, 2013 gets written to `myapp
The syntax of the autoRollAtTime is specified by [TimeSpan.ToString(String)](https://docs.microsoft.com/dotnet/api/system.timespan.tostring#System_TimeSpan_ToString_System_String_). The syntax of the autoRollAtTime is specified by [TimeSpan.ToString(String)](https://docs.microsoft.com/dotnet/api/system.timespan.tostring#System_TimeSpan_ToString_System_String_).
For example, in the above example, at the start of the day it will roll the file over. For example, in the above example, at the start of the day it will roll the file over.
### Automatic archiving of logs
:warning: This feature is reported to be broken in recent WinSW versions.
It is a potential subject for removal.
```xml
<log mode="roll-by-size-time">
<zipOlderThanNumDays>5</zipOlderThanNumDays>
<zipDateFormat>yyyyMM</zipDateFormat>
</log>
```
The `zipOlderThanNumDays` can only be used in conjection with autoRollAtTime, provide the number of days of files to keep. The `zipOlderThanNumDays` can only be used in conjection with autoRollAtTime, provide the number of days of files to keep.
```xml ```xml