package edu.osu.cse421; import java.util.logging.Logger; import java.util.logging.Level; public class Student { private static final Logger LOG = Logger.getLogger(Student.class.getName()); private void m() { if (LOG.isLoggable(Level.FINER)) { LOG.entering(getClass().getName(), "m"); } // implementation of m() if (LOG.isLoggable(Level.FINER)) { LOG.exiting(getClass().getName(), "m"); } } public static void main(String[] args) { Student s = new Student(); System.out.println("Default configuration " + "(won't print FINER messages)"); Loggers.showLoggerTreeInfo(LOG); System.out.println("calling m()..."); s.m(); System.out.println("Modifying level of Student's LOG " + "(still won't print FINER messages)"); LOG.setLevel(Level.FINER); Loggers.showLoggerTreeInfo(LOG); System.out.println("calling m()..."); s.m(); System.out.println("Modifying level of Root Handler"); Logger.getLogger("").getHandlers()[0].setLevel(Level.ALL); Loggers.showLoggerTreeInfo(LOG); System.out.println("calling m()..."); s.m(); System.out.println("Creating a new logger, which becomes part " + "of the logging hierarchy"); Logger.getLogger("edu.osu"); Loggers.showLoggerTreeInfo(LOG); } }