how to generate the instance for logger?

Posted by Elakkiya on Stack Overflow See other posts from Stack Overflow or by Elakkiya
Published on 2011-06-03T12:32:04Z Indexed on 2011/11/15 1:51 UTC
Read the original article Hit count: 164

Filed under:
|

Here is my code

package com.my;
import org.apache.log4j.spi.LoggerFactory;
import java.io.*;
import java.util.logging.*;

public class Log {
      public static void main(String[] args) {
      try{
           FileHandler hand = new FileHandler("vk.log");
           Logger log = Logger.getLogger("log_file");
           log.addHandler(hand);
           log.warning("Doing carefully!");
           log.info("Doing something ...");
           log.severe("Doing strictily ");
           System.out.println(log.getName());
      }
      catch(IOException e){
           System.out.println(e)
      }
    }

}

© Stack Overflow or respective owner

Related posts about java

Related posts about logging