Add simple logger

to Java application

Published: Updated:
Published: Updated:

Table of contents

Gradle snippet:

build.gradle

dependencies {
    implementation 'org.slf4j:slf4j-api:1.7.30'
    implementation 'org.slf4j:slf4j-simple:1.7.30'
}

Add to your code (where the Test class is your code):

Test.java

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

class Test {
    private static final Logger logger = LoggerFactory.getLogger(Test.class);

Log levels

From the manual:

  • trace
  • error
  • warn
  • info
  • debug

No "panic", no "warning"!

SLF4J and LOGBACK

TODO

Rate this page