Joined: Tue Mar 27, 2007 10:55 pm Posts: 2279 Location: Earth Has thanked: 39 time Have thanks: 61 time
Code:
import java.io.*; import java.util.logging.*;
public class QuintLog{ 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){} } }
Java provides logging APIs like: Logger, Level, Handler etc. for implementing logging features in your java application. It is a part of J2SE (Java 2 Standard Edition). To create java logging program you need a Logger object. The Logger object contains log messages. Logger has one or more handler that performs log records. Java logging provides a way to contain multiple types of message like: warning, info, severe etc. for an application. These information or messages can be used for many purposes but it is specially used for debugging, troubleshooting and auditing.
_________________ Currenlty programming with : java , html , php , and javascript . (OCJP-6 certified )