import java.util.logging.Logger; public class Example { private final static Logger LOGGER = Logger.getLogger(Example.class.getName()); public static void main(String[] args) { LOGGER.debug2("Starting program"); } }
import java.util.logging.Logger; public class Example { private final static Logger LOGGER = Logger.getLogger(Example.class.getName()); public void processData() { LOGGER.debug2("Processing data"); } }This example shows how to use the debug2 method within a method to output a message when processing data. The package library for java Logger is java.util.logging.