java类库详细讲解
源代码在线查看: islog.html
Determining If a Message Will Be Logged
(Java Developers Almanac Example)
BODY CODE {font-family: Courier, Monospace; font-size: 11pt} TABLE, BODY {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10pt} PRE {font-family: Courier, Monospace; font-size: 10pt} H3 {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11pt} A.eglink {text-decoration: none} A:hover.eglink {text-decoration: underline} -->
The Java Developers Almanac 1.4
Order this book from Amazon.
Home
>
List of Packages
>
java.util.logging
[20 examples]
e386.
Determining If a Message Will Be Logged
See also e389 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");
}
Related Examples
e385.
The Quintessential Logging Program
e387.
Logging a Method Call
e388.
Logging an Exception
e389.
Minimizing the Impact of Logging Code
e390.
Preventing a Logger from Forwarding Log Records to its Parent
e391.
Writing Log Records to a Log File
e392.
Writing Log Records to Standard Error
e393.
Writing Log Records Only After a Condition Occurs
e394.
Setting a Filter on a Logger Handler
See also:
Configuration
File Size
Formatters
Levels
© 2002 Addison-Wesley.