Hackerss.com is a community of amazing hackers

Hackerss is a community for developers, data scientitst, ethical hackers, hardware enthusiasts or any person that want to learn / share their knowledge of any aspect of digital technology.

Create account Log in

Posted on

Example use of slf4j in Java

Example use of slf4j - Java:

package com.javacodegeeks.examples.logback;

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

* This class is an example of how to use slf4j with javadoc.
* @author javacodegeeks.com
public class ExampleSlf4j {
   * This method is an example of how to use slf4j with javadoc.
   * @param args String[]
   public static void main(String[] args) {
       //Create a logger instance with the name of the class
       Logger logger = LoggerFactory.getLogger(ExampleSlf4j.class);
       //Log a message with the info level
       logger.info("This is an info message");
       //Log a message with the debug level
       logger.debug("This is a debug message");
       //Log a message with the error level
       logger.error("This is an error message");

Enter fullscreen mode Exit fullscreen mode

Top comments (0)