Logger setParent() method in Java with Examples
setParent() method of a Logger class used to set the parent Logger of this current Logger.The parent Logger we want to set is passed as a parameter. LogManager use this method to update a Logger when the namespace changes.
public void setParent(Logger parent)
Parameters: This method accepts one parameter parent which represents the new parent logger.
Return value: This method returns nothing.
Exception: This method throws SecurityException if a security manager exists and if the caller does not have LoggingPermission(“control”).
Below programs illustrate the setParent() method:
The output printed on console of Eclipse is shown below-
The output printed on console output is shown below-
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.