Logger SetUseParentHandlers() Example

Started by VelMurugan, Dec 05, 2008, 02:04 PM

Previous topic - Next topic

VelMurugan

Logger SetUseParentHandlers() Example

Specify whether or not this logger should send its output to it's parent Logger

Loggerclass SetUseParentHandlers() method example. This example shows you how to use SetUseParentHandlers() method.This method Specify whether or not this logger should send its output to it's parent Logger

Here is the code:-


/*
* @Program that Specify whether or not this logger should send its output to
    it's parent Logger.
* SetUseParentHandlers.java
* Author:-RoseIndia Team
* Date:-2-July-2008
*/

import java.util.logging.Logger;
import java.util.logging.Level;

public class SetUseParentHandlers {

    public static void main(String[] args) {
        Logger logger = Logger.getLogger("g.log");
        //Specify whether or not this logger should send its output to it's parent Logger
        logger.setUseParentHandlers(true);
        System.out.println(logger.getUseParentHandlers());
    }
}


Output of the program:-

true

Source : CodeDiary