RotatingFileAppender class
A file appender which will rotate the log file once it reaches rotateAtSizeBytes bytes. Will keep keepRotateCount number of files. If the baseFilePath cannot be calculated synchronously you can use a AsyncInitializingLogHandler to buffer log messages until the baseFilePath is ready.
- Inheritance
-
- Object
- BaseLogAppender
- RotatingFileAppender
Constructors
- RotatingFileAppender({LogRecordFormatter? formatter, required String baseFilePath, int keepRotateCount = 3, int rotateAtSizeBytes = 10 * 1024 * 1024, Duration rotateCheckInterval = const Duration(minutes: 5), Clock clock = const Clock()})
Properties
- baseFilePath → String
-
(Absolute) path to base file (ie. the current log file).
final
- clock → Clock
-
final
- formatter → LogRecordFormatter
-
finalinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- instanceId → int
-
final
- keepOpenDuration → Duration
-
how long to keep log file open. will be closed once this duration
passed without a log message.
final
- keepRotateCount → int
-
the number of rotated files to keep.
e.g. if this is 3 we will create
filename
,filename.1
,filename.2
.final - rotateAtSizeBytes → int
-
The size in bytes we allow a file to grow before rotating it.
final
- rotateCheckInterval → Duration
-
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
attachToLogger(
Logger logger) → void -
inherited
-
call(
LogRecord record) → void -
inherited
-
detachFromLoggers(
) → Future< void> -
inherited
-
dispose(
) → Future< void> -
override
-
forceFlush(
) → Future< void> -
getAllLogFiles(
) → List< File> - Returns all available rotated logs, starting from the most current one.
-
handle(
LogRecord record) → void -
override
-
logListener(
) → LogRecordListener -
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- debugLogger → Logger
-
no setter
- id ↔ int
-
getter/setter pair