Hackerss.com

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
hackerss
hackerss

Posted on

User a logger in Java

User a logger - Java:


import java.util.logging.Logger;

/**
* This class is used to create a logger with javadoc.
* @author Juan Carlos Fonseca
* @version 1.0
*/
public class LoggerExample {
   /**
   * This method is used to create a logger with javadoc.
   * @param args Unused.
   * @return Nothing.
   */   
   public static void main(String[] args) {
      // Create a logger with the name of the class
      Logger logger = Logger.getLogger(LoggerExample.class.getName());
      // Log a message with the info level
      logger.info("This is an info message");
      // Log a message with the warning level
      logger.warning("This is a warning message");
      // Log a message with the severe level
      logger.severe("This is a severe message");
   }
}

Enter fullscreen mode Exit fullscreen mode

Top comments (0)