Table of Contents
When a-message is logged via a Logger
it's logged with a certain log level. The built-in log levels is:
- SEVERE
- WARNING
- INFO
- CONFIG
- FINE
- Finer
- FINEST
The log level was represented by the class java.util.logging.Level
. This class contains a constant for each of the above log levels. It is one of the these constants you use when you log a message to a Logger
. Here are an example:
Logger.log (level.severe, "A SEVERE message!");
Filtering Messages
You can filter the messages by their log level, meaning you can configure a to not Logger
log, and not propagate messages B Elow a certain level. Here is a example of that:
Logger.setlevel (level.warning);
The now Logger
ignores all messages below the log level WARNING
.
To understand how log levels behave Logger
in the hierarchy, check out the text on the Logger hierarchy.
Java Logging:log Levels