1 package org.infoglue.cmsinstaller; 2 3 25 26 import java.io.*; 27 28 public class Logger 29 { 30 private static PrintWriter pw = null; 31 32 private static void initializePrintWriter() throws Exception 33 { 34 pw = new PrintWriter(new FileOutputStream("install.log")); 35 36 } 37 38 public static void logInfo(String message) 39 { 40 System.out.println(message); 41 42 try 43 { 44 if(pw == null) 45 initializePrintWriter(); 46 47 pw.println(message); 48 pw.flush(); 49 } 50 catch(Exception e) 51 { 52 e.printStackTrace(); 53 } 54 } 55 56 57 public void finalize() 58 { 59 System.out.println("Running finalize..."); 60 try 61 { 62 pw.flush(); 63 pw.close(); 64 } 65 catch(Exception e){e.printStackTrace();} 66 } 67 } | Popular Tags |