Preventing a Logger from Forwarding Log Records to Its Parent - Java Java Virtual Machine

Java examples for Java Virtual Machine:Logger

Description

Preventing a Logger from Forwarding Log Records to Its Parent

Demo Code

import java.util.logging.Logger;

public class Main {

  public void m() {
    // Get a logger
    Logger logger = Logger.getLogger("com.mycompany");

    // Stop forwarding log records to ancestor handlers
    logger.setUseParentHandlers(false);/* w w  w  .  j  ava2  s.  c om*/

    // Start forwarding log records to ancestor handlers
    logger.setUseParentHandlers(true);
  }
}

Related Tutorials