CountLabeler
, ProcessIdLabeler
, TimestampLabeler
public interface Labeler
RollingFileWriter
.
The annotation PropertiesSupport
must be added to the implemented
labeler class and the implemented labeler must be registered as service in
"META-INF/services/org.pmw.tinylog.labelers" in order to make the labeler available by properties files and system
properties.
Example:
@PropertiesSupport(name = "count")
public final class CountLabeler implements Labeler {
A labeler must have a default constructor without any parameters. Optionally it can have an additional constructor with a string parameter if the labeler supports parameters.
Modifier and Type | Method | Description |
---|---|---|
File |
getLogFile(File baseFile,
int maxBackups) |
Returns the real log file.
|
void |
init(Configuration configuration) |
Initialize the labeler.
|
File |
roll(File file,
int maxBackups) |
Rolls existing log files and backups and returns a new log file.
|
void init(Configuration configuration)
configuration
- Configuration of loggerFile getLogFile(File baseFile, int maxBackups)
baseFile
- Defined log file by usermaxBackups
- Maximum number of backups to storeFile roll(File file, int maxBackups) throws IOException
file
- Current log filemaxBackups
- Maximum number of backups to storeIOException
- Failed to roll log fileCopyright © 2019. All rights reserved.