Expand description
Improved replacement for tracing_appender::rolling
Like tracing_appender::rolling
but:
- Can write multiple series of output files, each with a different filter level.
- With some bugs fixed.
- We use the word
rotate
not the unidiomaticroll
.
§Features
- Needs to “own” the output directory,
so that it can manage all files
*.log
. - Guarantees not to leave old stale logfiles from previous configurations, even if the configuration is changed.
- But, configuration change needs recreation of the
Appender
.
§Rationale
Debian’s tag2upload-service-manager
uses rocket
so we tried to use tracing
for logging.
However, we have come to the conclusion that tracing
is not fit for purpose.
One of the biggest issues is that the model is not documented.
The composition of the various pieces is confusing, and, we strongly suspect, not fully coherent.
See
#2141;
this also seems to be generating many bug reports from confused users
who haven’t analysed the situation as thoroughly as was done there.
For this reason, we don’t want to try to have multiple Subscriber
s
or try to use Layer
s.
Instead, we do all the level filtering directly, here.
We tried using RollingFileAppender
but tripped over a bug
that broke the tests:
it doesn’t rotate logfiles until the first entry is written
(#2937).
Other tickets in the upstream tracker aren’t encouraging,
eg #1932.
Structs§
- Appender
- Tracing Appender that writes to files, with rotation and expiry
- Config
- Configuration for a
tracing_logrotate::Appender
- Level
Config - Rotation configuration for a set of logfiles at a particular level
- Writer
Writer
forAppender as tracing_subscriber::fmt::MakeWriter
Enums§
- Interval
- Logfile rotation period