Writing Log Records to Standard Error - Java Java Virtual Machine

Java examples for Java Virtual Machine:Logger

Description

Writing Log Records to Standard Error

Demo Code

import java.util.logging.ConsoleHandler;
import java.util.logging.Logger;

public class Main {
  public void m() throws Exception {
    // Create a console handler
    ConsoleHandler handler = new ConsoleHandler();

    // Add to logger
    Logger logger = Logger.getLogger("com.mycompany");
    logger.addHandler(handler);//from w  w  w .  j av a 2  s  .c  o  m
  }
}

Related Tutorials