How do I check if a message is loggable?
Category: java.util.logging, viewed: 960 time(s).
The Logger class provide a setLevel() method to set
the logging level. By setting logging to a certain level we can control which
message will be logged.
To determine or check if a message will be logged we can use the
Logger.isLoggable(Level level) method. Let see the example below.
This will result only the Level.WARNING and Level.SEVERE messages are logged.
27 Apr 09 13:49:58 org.kodejava.example.util.logging.LoggingLevelCheck main WARNING: Application Warning Information 27 Apr 09 13:49:58 org.kodejava.example.util.logging.LoggingLevelCheck main SEVERE: Application Severe Information
Download Hundreds of Complimentary Industry Resources
Get hundreds of popular Industry magazines, white papers, webinars, podcasts, and more;
all available at no cost to you. With more than 600 complimentary offers, you'll find
plenty of titles to suit your professional interests and needs.
Click Here and Sign up today!


