Logger getParent() Method in Java with Examples
getParent() method of a Logger class is used to get the parent of this Logger.This method returns the nearest extant parent in the namespace.if there is a Logger called “com.javac.core.api”, and a Logger called “com.javac” has been created but no logger “com.javac.core” exists, then a call of getParent on the Logger “com.javac.core.api” will return the Logger “com.javac”. The result will be null if we apply getParent() method on root Logger in the namespace.
public Logger getParent()
Parameters: This method accepts nothing.
Return value: This method return nearest existing parent Logger.
Below programs illustrate the getName() method:
logger name = com.java.core
Parent logger name = com.java
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.