Determining If a Message Will Be Logged

See also Minimizing the Impact of Logging Code.
Logger logger = Logger.getLogger("com.mycompany.MyClass"); // Check if the message will be logged if (logger.isLoggable(Level.FINEST)) { logger.finest("my finest message"); }

Comments

10 Jan 2010 - 2:12pm by Anonymous (not verified)

After the site was updated, code cut and paste doesn't work properly. Code formatting gets lost during the copy, resulting in a single line of code.

Post a comment

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Enter the characters shown in the image. Ignore spaces and be careful about upper and lower case.