Skip to content

Commit c56cd2d

Browse files
committed
[test] Add test and doc for Duration format
1 parent c8c43a1 commit c56cd2d

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/main/minisite/content/jul-integration.adoc

+6-2
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,16 @@ Here is its configuration - all are prefixed with `io.yupiik.logging.jul.handler
5757
| bufferSize | -1 | if positive the in memory buffer used to store data before flushing them to the disk (in bytes)
5858
| archiveDirectory | ${application.base}/logs/archives/ | where compressed logs are put.
5959
| archiveFormat | gzip | zip or gzip.
60-
| archiveOlderThan | -1 | how many days files are kept before being compressed
61-
| purgeOlderThan | -1 | how many days files are kept before being deleted, note: it applies on archives and not log files so 2 days of archiving and 3 days of purge makes it deleted after 5 days.
60+
| archiveOlderThan | -1 | how many days files are kept before being compressed (in Duration Format)
61+
| purgeOlderThan | -1 | how many days files are kept before being deleted, note: it applies on archives and not log files so 2 days of archiving and 3 days of purge makes it deleted after 5 days (in Duration Format).
6262
| compressionLevel | -1 | In case of zip archiving the zip compression level (-1 for off or 0-9).
6363
| maxArchives | -1 | Max number of archives (zip/gzip) to keep, ignored if negative (you can review `io.yupiik.logging.jul.handler.LocalFileHandlerTest.purgeMaxArchive` for some sample configuration).
6464
|===
6565

66+
=== Duration Format
67+
68+
The format for the String to be parsed is `PnDTnHnMn.nS` where `nD` means `n` number of Days, `nH` means `n` number of Hours, `nM` means `n` number of Minutes, `nS` means `n` number of Seconds and `T` is a prefix that must be used before the part consisting of `nHnMn.nS`.
69+
6670
== Async handler
6771

6872
`io.yupiik.logging.jul.handler.AsyncHandler` enables to handle asynchronously in a background thread log events (`LogRecord`).

yupiik-logging-jul/src/test/java/io/yupiik/logging/jul/handler/LocalFileHandlerTest.java

+1
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ public void logAndRotate() throws IOException {
6565
config.put("limit", Long.toString(10 * 1024));
6666
config.put("level", "INFO");
6767
config.put("dateCheckInterval", "PT1S");
68+
config.put("archiveOlderThan", "P2D");
6869

6970
final LocalFileHandler handler = new LocalFileHandler() {
7071
@Override

0 commit comments

Comments
 (0)