Skip to content

Commit

Permalink
docs(triger:time): Update the documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
Dirreke committed Dec 1, 2023
1 parent 8965543 commit ffac855
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 5 deletions.
35 changes: 31 additions & 4 deletions docs/Configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,10 +171,12 @@ my_rolling_appender:
The new component is the _policy_ field. A policy must have `kind` like most
other components, the default (and only supported) policy is `kind: compound`.

The _trigger_ field is used to dictate when the log file should be rolled. The
only supported trigger is `kind: size`. There is a required field `limit`
which defines the maximum file size prior to a rolling of the file. The limit
field requires one of the following units in bytes, case does not matter:
The _trigger_ field is used to dictate when the log file should be rolled. It
supports two types: `size`, and `time`. They both require a `limit` field.

For `size`, the `limit` field is a string which defines the maximum file size
prior to a rolling of the file. The limit field requires one of the following
units in bytes, case does not matter:

- b
- kb/kib
Expand All @@ -190,6 +192,31 @@ trigger:
limit: 10 mb
```

For `time`, the `limit` field is a string which defines the maximum file size
prior to a rolling of the file. The limit field supports the following units
(the second will be used if the unit is not specified), case does not matter:

- second[s]
- minute[s]
- hour[s]
- day[s]
- week[s]
- month[s]
- year[s]

> note: The log file will be rolled at the integer time. For example, if the
`limit` is set to `2 day`, the log file will be rolled at 0:00 every other a
day, regardless of the time `log4rs` was started or the log file was created.
It means that the first log file will be rolled before the limit is reached.

i.e.

```yml
trigger:
kind: time
limit: 7 day
```

The _roller_ field supports two types: delete, and fixed_window. The delete
roller does not take any other configuration fields. The fixed_window roller
supports three fields: pattern, base, and count. The most current log file will
Expand Down
2 changes: 1 addition & 1 deletion examples/sample_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ appenders:
limit: 1 minute
roller:
kind: fixed_window
pattern: "log/old-log-{}-.log"
pattern: "log/old-log-{}.log"
base: 0
count: 2
root:
Expand Down

0 comments on commit ffac855

Please sign in to comment.