Getting Started
Download tinylog 2.7.0 and add
tinylog-api.jar
andtinylog-impl.jar
to your classpath. If you use a build tool such as Maven or Gradle, you can add both JAR files as dependencies.Add a logging statement to your application:
import org.tinylog.Logger; public class Application { public static void main(String[] args) { Logger.info("Hello World!"); } }
As you can see, tinylog has a static logger. Therefore, it is not necessary to create an instance of the logger class.
When you run this small application, you will see the following output in the console:
2018-03-31 18:15:32 [main] Application.main() INFO: Hello World!
You can configure tinylog by creating a properties file with the name
tinylog.properties
in the default classpath. If you use a build tool such as Maven or Gradle, it is usually located atsrc/main/resources
. For plain IDE projects, it is usually located directly atsrc
along with source files and packages.Example
tinylog.properties
:writer = console writer.format = {date: HH:mm:ss.SSS} {level}: {message}
When you run the application, you will now see the following output in the console:
18:29:57.382 INFO: Hello World!
For a detailed documentation of all configuration parameters, see the configuration page, and for all logging methods, see the logging page.