Esempio n. 1
0
 public static void init() {
   try {
     Logger.writer =
         new FileWriter(
             System.getProperty("user.home")
                 + System.getProperty("file.separator")
                 + ".crumb"
                 + System.getProperty("file.separator")
                 + "crumb.log",
             true);
     Logger.writer2 =
         new FileWriter(
             System.getProperty("user.home")
                 + System.getProperty("file.separator")
                 + ".crumb"
                 + System.getProperty("file.separator")
                 + "last.log",
             false);
     Logger.writing = true;
   } catch (Exception e) {
     Logger.printErrorStack(e);
     Logger.severe("Could not write to log file.");
     Logger.writing = false;
   }
 }
Esempio n. 2
0
 public static void close() {
   try {
     if (Logger.writer != null) {
       Logger.writer.close();
       Logger.writer = null;
     }
     if (Logger.writer2 != null) {
       Logger.writer2.close();
       Logger.writer2 = null;
     }
     if (Logger.writer == null && Logger.writer2 == null) {
       Logger.writing = false;
     } else {
       throw new Exception();
     }
   } catch (Exception e) {
     Logger.severe("Could not close the log file stream. Attempting again.");
     Logger.printErrorStack(e);
     Logger.close();
   }
 }
Esempio n. 3
0
 public static void printErrorStack(Exception e) {
   Logger.severe(e.getMessage());
   for (StackTraceElement element : e.getStackTrace()) Logger.severe(element.toString());
 }