java自带log java.util.logging.Logger使用三步曲

 import java.util.logging.Logger;     // <= (1)
  public class HelloLogWorld {
    private static String name = HelloLogWorld.class.getName();    
    private static Logger log = Logger.getLogger(name);// <= (2)
    public void sub() {
      log.info("Hello Logging World");    // <= (3)
    }
    public static void main(String[] args) {
      HelloLogWorld logWorld = new HelloLogWorld();
      logWorld.sub();
    }
  }

你可能感兴趣的:(JAVA)