Logger setUseParentHandlers() method in Java with Examples Last Updated : 26 Mar, 2019 Comments Improve Suggest changes Like Article Like Report setUseParentHandlers() method of a Logger class used to set the configuration which defines whether or not this logger should send its output to its parent Logger. if we want to send the output to its parent Logger then we have to set the parameter to this method equal to true. This means that any log records will also be written to the parent's Handlers, and potentially to its parent, recursively up the namespace. Syntax: public void setUseParentHandlers(boolean useParentHandlers) Parameters: This method accepts one parameter useParentHandlers which represents true if output is to be sent to the logger's parent. Return value: This method returns nothing. Exception: This method throws SecurityException if a security manager exists, this logger is not anonymous, and the caller does not have LoggingPermission("control"). Below programs illustrate the setUseParentHandlers() method: Program 1: Java // Java program to demonstrate // Logger.setUseParentHandlers() method import java.util.logging.Logger; public class GFG { private static Logger logger = Logger.getLogger( GFG.class .getPackage() .getName()); public static void main(String args[]) { // Set that this logger will // sent logs to its parent logger. logger.setUseParentHandlers(true); // Log the flag value logger.info("output sent to the" + " logger's parent - " + logger.getUseParentHandlers()); } } Output: The output printed on console of Eclipse is shown below- Program 2: Java // Java program to demonstrate // Logger.setUseParentHandlers() method import java.util.logging.Logger; public class GFG { private static Logger logger = Logger.getLogger( GFG.class .getPackage() .getName()); public static void main(String args[]) { // Set that this logger will not // send logs to its parent logger. logger.setUseParentHandlers(false); // Print the flag value System.out.println("output sent to the" + " logger's parent - " + logger.getUseParentHandlers()); } } Output: The output printed on console output is shown below- Reference: https://docs.oracle.com/javase/10/docs/api/java/util/logging/Logger.html#setUseParentHandlers(boolean) Comment More infoAdvertise with us Next Article Logger setUseParentHandlers() method in Java with Examples A AmanSingh2210 Follow Improve Article Tags : Java Java - util package Java-Functions Java-Logger Practice Tags : Java Similar Reads 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. Syntax: public void setParent(Logger parent) Parameters: This method accepts 2 min read Logger removeHandler() method in Java with Examples removeHandler() method of a Logger class is used to remove a log Handler from Logger. A Handler is a component of JVM that takes care of actual logging to the defined output writers like a file, console out etc. It returns silently if the given Handler is not found or is null.Syntax: public void rem 2 min read LogRecord setParameters() method in Java with Examples The setParameters() method of java.util.logging.LogRecord is used to set the parameters to the log message.These parameters are the parameters to be inserted into the message of this LogRecord. Syntax: public void setParameters(Object[] parameters) Parameters: This method accepts parameters as param 2 min read Logger setLevel() method in Java with Examples setLevel() method of a Logger class used to set the log level to describe which message levels will be logged by this logger. The level we want to set is passed as a parameter. Message levels lower than passed log level value will be discarded by the logger. The level value Level.OFF can be used to 2 min read Logger severe() method in Java with Examples The severe() method of a Logger class used to Log a SEVERE message.This method is used to pass SEVERE types logs to all the registered output Handler objects. SEVERE Message: Severe occurs when something terrible has occurred and the application cannot continue further. Ex like database unavailable, 2 min read Like