Java examples for Java Virtual Machine:Logger
Determining If a Message Will Be Logged
import java.util.logging.Level; import java.util.logging.Logger; public class Main { public void m() throws Exception { Logger logger = Logger.getLogger("com.mycompany.MyClass"); // Check if the message will be logged if (logger.isLoggable(Level.FINEST)) { logger.finest("my finest message"); }/*from ww w .j a v a 2s .com*/ } }