Пример #1
0
 public void disableFileMode() {
   if (isFileModeActive()) {
     try {
       logFileWriter.close();
       if (ntClient.isRestartingModeEnabled() && ntClient.isLastRun())
         logFileWriter.rename(
             "Debug_"
                 + StringUtils.formatDateTime(System.currentTimeMillis(), "-", "", "T")
                 + ".log",
             FileIO.FILE_EXISTS_STRATEGY_CREATE_RENAMED_FILE); // rename file to seal it
       logFileWriter.dispose();
     } catch (Exception ignore) {
     } finally {
       logFileWriter = null;
       logFilePath = null;
     }
   }
 }
Пример #2
0
 public void dumpCrashLog(String folderPath) throws Exception {
   if (ntClient == null)
     throw new NullPointerException("NTClient cannot be null (Logger.dumpCrashLog())");
   try {
     logFileWriter =
         ntClient.getFileWriter(
             folderPath
                 + "Crash_"
                 + StringUtils.formatDateTime(System.currentTimeMillis(), "-", "", "T")
                 + ".log");
     logFileWriter.open(
         FileIO.FILE_EXISTS_STRATEGY_REPLACE, FileIO.FILE_DOES_NOT_EXIST_STRATEGY_CREATE);
     debug("Dumping crash log...");
     logFileWriter.write(getBuffer(true));
     logFileWriter.close();
     logFileWriter.dispose();
   } catch (Exception ignore) {
   } finally {
     logFileWriter = null;
   }
 }