Java Log:Basic Logging
import java.util.logging.*; import java.io.*; public class BasicLogging { private static Logger logger = Logger.getLogger("MyLogger"); private ConsoleHandler console = null; private FileHandler file = null; public BasicLogging() { console = new ConsoleHandler(); try{ file = new FileHandler("basicLogging.out"); }catch(IOException ioe){ logger.warning("Could not create a file..."); } logger.addHandler(console); logger.addHandler(file); } public void logMessage() { logger.info("I am logging test message.."); } public static void main(String args[]) { BasicLogging demo = new BasicLogging(); demo.logMessage(); } }