simple-logger is logger utility for Java and it works out-of-the-box. It does not need any configuration files. All parameters can be set directly from the code. simple-logger provides six standard logging levels: TRACE, DEBUG, INFO, WARN, ERROR and FATAL. simple-logger supports file-rolling; max file size and number of backups are configurable.
simple-logger is written in Java and should run on all systems with JRE 1.4 or above installed (OS X, Win, Unix).

User manual

Quick start

Start using simple-logger by simply creating new object:

SimpleLogger logger = new SimpleLogger();

At least path to log file should be set, otherwise simple-logger will write into default log file (called simple-logger.log inside your project directory):


Now you are ready to log the first line:

logger.info("Hello simple-logger!");

Logging levels

The method names are equal to other loggers, so the implementation library can easily be switched to simple-logger.
simple-logger provides six levels of logging. Basic methods to write log file are:

trace(String s)
debug(String s)
info(String s)
warn(String s)
error(String s)
fatal(String s)

All above methods for logging also accept additional argument throwable, which write exception stack trace to log file. Eg. error(String s, Throwable t)

Configuration parameters

Logger parameters can be set in Java code. simple-logger provides the following methods for configuration:

setFilename(String filename) Set path and name of log file. Eg: /path/to/log/file/mylog.log
Default value is ./simple-logger.log
setAppend(boolean append) 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
setLogLevel(int level) Set logging level. Logging levels are defined in LEVEL class: TRACE, DEBUG, INFO, WARN, ERROR and FATAL
Default value is LEVEL.INFO
setDateFormat(String format) 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
setMaxSizeMb(int maxSizeMb) 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
setBackup(int backup) 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
setVerbose(boolean verbose) Enable 'System.out.println' option.
Default value false (disabled)


I do not take any responsibility regarding the usage (or misusage) of simple-logger.