Logger parameters can be set inline inside Java code. simple-logger
supports the following methods for configuration:
Set path and name of log file. Eg: /path/to/log/file/mylog.log
Default value is ./simple-logger.log
setFilename(String filename)
Set true to append text to existing log file. If set to false,
log file will be overwritten and started from the scratch.
Default value is true.
setAppend(boolean append)
Set logging level. Logging levels are defined in LEVEL class:
TRACE, DEBUG, INFO, WARN, ERROR and FATAL
Default value is LEVEL.INFO.
setLogLevel(int level)
Set java specific date format. Eg. format yyyy.MM.dd hh:mm:ss:SSS
gives year, month, day, hour, minutes, seconds and milliseconds.
Default value is yyyy.MM.dd hh:mm:ss:SSS
setDateFormat(String format)
Set maximum size of log file in megabytes. When the limit is reached
new log file is opened and logging continues. Previous log file gets
.1 suffix.
Default value is 10.
setMaxSizeMb(int maxSizeMb)
Set number of rolling log files. When max file size of active log file
is reached, it is renamed to filename.1, and filename.1 is renamed to
filename.2 an so on... The number of last backup log files is defined
with backup parameter.
Default value is 5.
setBackup(int backup)
Enable 'System.out.println' option.
Default value false (disabled).
setVerbose(boolean verbose)
Alternatively configure simple-logger with properties file. Here are the parameters:
simplelogger.filename=./simple-logger.log
simplelogger.level=INFO
simplelogger.append=true
simplelogger.verbose=false
simplelogger.maxFileSize=1
simplelogger.maxBackupFiles=2
simplelogger.dateFormat=yyyy.MM.dd hh:mm:ss:SSS