The parse() method of java.util.logging.Level is used to parse a level name string into a Level. The name of the logging level must be a valid logging name. The argument string may consist of either a level name or an integer value. Level example name: “INFO”, “800”.
public static Level parse(String name) throws IllegalArgumentException
Parameters: This method accepts a name which is the string to be parsed.
Return: This method returns parsed value.
Exception: This method throws the following Exception:
- NullPointerException: if the name is null.
- IllegalArgumentException: if the value is not valid. Valid values are integers between Integer.MIN_VALUE and Integer.MAX_VALUE, and all known level names.
Below programs illustrate parse() method:
Level = WARNING
Level = FINER
Attention reader! Don’t stop learning now. Get hold of all the important Java Foundation and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more, please refer Complete Interview Preparation Course.