The Java Developers Almanac 1.4


Order this book from Amazon.

   
Home > List of Packages > java.util.logging  [20 examples] > Levels  [4 examples]

e397. Comparing Log Levels

To compare the severity of two logging levels, use Level.intValue().
    // Find the more severe log level
    Level level1 = Level.INFO;
    Level level2 = Level.CONFIG;
    
    if (level1.intValue() > level2.intValue()) {
        // level1 is more severe
    } else if (level1.intValue() < level2.intValue()) {
        // level2 is more severe
    } else {
        // level1 == level2
    }

 Related Examples
e395. Setting the Log Level of a Logger
e396. Getting the Log Level of a Logger
e398. Creating a Custom Log Level

See also: Configuration    File Size    Formatters   


© 2002 Addison-Wesley.