From: Ben Soares Date: Wed, 12 Aug 2020 12:48:57 +0000 (+0100) Subject: JAL-3676 Removed BACKUPFILESPRESETENTRY logging for opening the file browser. Changed... X-Git-Tag: Release_2_11_1_1~13^2~15^2 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=9bb594782eecfaa798bbfdfff955ccd100a02b4f;p=jalview.git JAL-3676 Removed BACKUPFILESPRESETENTRY logging for opening the file browser. Changed most BACKUPFILES logging from DEBUG to TRACE level. Minor wording changes. --- diff --git a/src/jalview/gui/AlignFrame.java b/src/jalview/gui/AlignFrame.java index e4aa736..b2e05c5 100644 --- a/src/jalview/gui/AlignFrame.java +++ b/src/jalview/gui/AlignFrame.java @@ -1200,23 +1200,23 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, else { // create backupfiles object and get new temp filename destination - Cache.log.debug("ALIGNFRAME making backupfiles object for " + file); + Cache.log.trace("ALIGNFRAME making backupfiles object for " + file); BackupFiles backupfiles = new BackupFiles(file); try { String tempFilePath = backupfiles.getTempFilePath(); - Cache.log.debug( + Cache.log.trace( "ALIGNFRAME setting PrintWriter to " + tempFilePath); PrintWriter out = new PrintWriter(new FileWriter(tempFilePath)); - Cache.log.debug( + Cache.log.trace( "ALIGNFRAME about to write to temp file " + tempFilePath); out.print(output); - Cache.log.debug("ALIGNFRAME about to close file"); + Cache.log.trace("ALIGNFRAME about to close file"); out.close(); - Cache.log.debug("ALIGNFRAME closed file"); + Cache.log.trace("ALIGNFRAME closed file"); this.setTitle(file); statusBar.setText(MessageManager.formatMessage( "label.successfully_saved_to_file_in_format", new Object[] @@ -1233,7 +1233,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, { success = false; Cache.log.error( - "ALIGNFRAME Something else happened writing the temp file"); + "ALIGNFRAME Something unexpected happened writing the temp file"); Cache.log.error(ex.getMessage()); Cache.log.debug(Cache.getStackTraceString(ex)); } @@ -1242,7 +1242,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, Cache.log.debug("ALIGNFRAME writing temp file was " + (success ? "" : "NOT ") + "successful"); // do the backup file roll and rename the temp file to actual file - Cache.log.debug("ALIGNFRAME about to rollBackupsAndRenameTempFile"); + Cache.log.trace("ALIGNFRAME about to rollBackupsAndRenameTempFile"); success = backupfiles.rollBackupsAndRenameTempFile(); Cache.log.debug("ALIGNFRAME performed rollBackupsAndRenameTempFile " + (success ? "" : "un") + "successfully"); diff --git a/src/jalview/io/BackupFiles.java b/src/jalview/io/BackupFiles.java index 818603c..2acd6cc 100644 --- a/src/jalview/io/BackupFiles.java +++ b/src/jalview/io/BackupFiles.java @@ -131,7 +131,7 @@ public class BackupFiles { String tempfilename = file.getName(); File tempdir = file.getParentFile(); - Cache.log.debug( + Cache.log.trace( "BACKUPFILES [file!=null] attempting to create temp file for " + tempfilename + " in dir " + tempdir); temp = File.createTempFile(tempfilename, @@ -141,7 +141,7 @@ public class BackupFiles } else { - Cache.log.debug( + Cache.log.trace( "BACKUPFILES [file==null] attempting to create default temp file " + DEFAULT_TEMP_FILE + " with extension " + TEMP_FILE_EXT); @@ -164,15 +164,15 @@ public class BackupFiles public static void classInit() { Cache.initLogger(); - Cache.log.debug("BACKUPFILES classInit"); + Cache.log.trace("BACKUPFILES classInit"); boolean e = Cache.getDefault(ENABLED, true); setEnabled(e); - Cache.log.debug("BACKUPFILES " + (e ? "enabled" : "disabled")); + Cache.log.trace("BACKUPFILES " + (e ? "enabled" : "disabled")); BackupFilesPresetEntry bfpe = BackupFilesPresetEntry .getSavedBackupEntry(); - Cache.log.debug("BACKUPFILES preset scheme " + bfpe.toString()); + Cache.log.trace("BACKUPFILES preset scheme " + bfpe.toString()); setConfirmDelete(bfpe.confirmDelete); - Cache.log.debug("BACKUPFILES confirm delete " + bfpe.confirmDelete); + Cache.log.trace("BACKUPFILES confirm delete " + bfpe.confirmDelete); } public static void setEnabled(boolean flag) @@ -263,7 +263,7 @@ public class BackupFiles return true; } - Cache.log.debug("BACKUPFILES rollBackupFiles starting"); + Cache.log.trace("BACKUPFILES rollBackupFiles starting"); String dir = ""; File dirFile; @@ -271,7 +271,7 @@ public class BackupFiles { dirFile = file.getParentFile(); dir = dirFile.getCanonicalPath(); - Cache.log.debug("BACKUPFILES dir: " + dir); + Cache.log.trace("BACKUPFILES dir: " + dir); } catch (Exception e) { Cache.log.error( @@ -283,7 +283,7 @@ public class BackupFiles String filename = file.getName(); String basename = filename; - Cache.log.debug("BACKUPFILES filename is " + filename); + Cache.log.trace("BACKUPFILES filename is " + filename); boolean ret = true; // Create/move backups up one @@ -296,11 +296,11 @@ public class BackupFiles int nextIndexNum = 0; Cache.log - .debug("BACKUPFILES backupFiles.length: " + backupFiles.length); + .trace("BACKUPFILES backupFiles.length: " + backupFiles.length); if (backupFiles.length == 0) { // No other backup files. Just need to move existing file to backupfile_1 - Cache.log.debug( + Cache.log.trace( "BACKUPFILES no existing backup files, setting index to 1"); nextIndexNum = 1; } @@ -314,7 +314,7 @@ public class BackupFiles if (reverseOrder) { // backup style numbering - Cache.log.debug("BACKUPFILES rolling files in reverse order"); + Cache.log.trace("BACKUPFILES rolling files in reverse order"); int tempMax = noMax ? -1 : max; // noMax == true means no limits @@ -346,7 +346,7 @@ public class BackupFiles // no "oldest" file to delete previousFile = backupfile_n; fileToBeDeleted = null; - Cache.log.debug("BACKUPFILES No oldest file to delete"); + Cache.log.trace("BACKUPFILES No oldest file to delete"); continue; } @@ -357,9 +357,9 @@ public class BackupFiles File replacementFile = backupfile_n; long fileToBeDeletedLMT = fileToBeDeleted.lastModified(); long replacementFileLMT = replacementFile.lastModified(); - Cache.log.debug("BACKUPFILES fileToBeDeleted is " + Cache.log.trace("BACKUPFILES fileToBeDeleted is " + fileToBeDeleted.getAbsolutePath()); - Cache.log.debug("BACKUPFILES replacementFile is " + Cache.log.trace("BACKUPFILES replacementFile is " + backupfile_n.getAbsolutePath()); try @@ -384,7 +384,7 @@ public class BackupFiles boolean delete = confirmNewerDeleteFile(fileToBeDeleted, replacementFile, true); - Cache.log.debug("BACKUPFILES " + Cache.log.trace("BACKUPFILES " + (delete ? "confirmed" : "not") + " deleting file " + fileToBeDeleted.getAbsolutePath() + " which is newer than " @@ -459,12 +459,12 @@ public class BackupFiles } bfsb.append(backupFiles[i].getName()); } - Cache.log.debug("BACKUPFILES backupFiles: " + bfsb.toString()); + Cache.log.trace("BACKUPFILES backupFiles: " + bfsb.toString()); // noMax == true means keep all backup files if ((!noMax) && bfTreeMap.size() >= max) { - Cache.log.debug("BACKUPFILES noMax: " + noMax + ", " + "max: " + Cache.log.trace("BACKUPFILES noMax: " + noMax + ", " + "max: " + max + ", " + "bfTreeMap.size(): " + bfTreeMap.size()); // need to delete some files to keep number of backups to designated // max. @@ -474,7 +474,7 @@ public class BackupFiles int numToDelete = suffix.indexOf(NUM_PLACEHOLDER) > -1 ? bfTreeMap.size() - max + 1 : 0; - Cache.log.debug("BACKUPFILES numToDelete: " + numToDelete); + Cache.log.trace("BACKUPFILES numToDelete: " + numToDelete); // the "replacement" file is the latest backup file being kept (it's // not replacing though) File replacementFile = numToDelete < backupFiles.length @@ -487,7 +487,7 @@ public class BackupFiles File fileToBeDeleted = backupFiles[i]; boolean delete = true; - Cache.log.debug( + Cache.log.trace( "BACKUPFILES fileToBeDeleted: " + fileToBeDeleted); boolean newer = false; @@ -550,7 +550,7 @@ public class BackupFiles String latestBackupFilename = dir + File.separatorChar + BackupFilenameParts.getBackupFilename(nextIndexNum, basename, suffix, digits); - Cache.log.debug("BACKUPFILES Moving old file [" + file + Cache.log.trace("BACKUPFILES Moving old file [" + file + "] to latestBackupFilename [" + latestBackupFilename + "]"); // using boolean '&' instead of '&&' as don't want moveFileToFile attempt to // be conditional (short-circuit) @@ -726,10 +726,10 @@ public class BackupFiles for (int i = 0; i < deleteFiles.size(); i++) { File fileToDelete = deleteFiles.get(i); - Cache.log.debug( - "BACKUPFILES deleting fileToDelete:" + fileToDelete); + Cache.log.trace("BACKUPFILES about to delete fileToDelete:" + + fileToDelete); fileToDelete.delete(); - Cache.log.warn("deleting '" + fileToDelete.getName() + "'"); + Cache.log.warn("deleted '" + fileToDelete.getName() + "'"); } } @@ -903,13 +903,13 @@ public class BackupFiles try { // delete destination file - not usually necessary but Just In Case... - Cache.log.debug("BACKUPFILES deleting " + newFile.getAbsolutePath()); + Cache.log.trace("BACKUPFILES deleting " + newFile.getAbsolutePath()); newFile.delete(); - Cache.log.debug("BACKUPFILES moving " + oldFile.getAbsolutePath() + Cache.log.trace("BACKUPFILES moving " + oldFile.getAbsolutePath() + " to " + newFile.getAbsolutePath()); Files.move(oldPath, newPath, StandardCopyOption.REPLACE_EXISTING); ret = true; - Cache.log.debug("BACKUPFILES move seems to have succeeded"); + Cache.log.trace("BACKUPFILES move seems to have succeeded"); } catch (IOException e) { Cache.log.warn("Could not move file '" + oldPath.toString() + "' to '" diff --git a/src/jalview/io/BackupFilesPresetEntry.java b/src/jalview/io/BackupFilesPresetEntry.java index 0734665..ff8a5e6 100644 --- a/src/jalview/io/BackupFilesPresetEntry.java +++ b/src/jalview/io/BackupFilesPresetEntry.java @@ -135,8 +135,6 @@ public class BackupFilesPresetEntry { String savedPresetString = Cache .getDefault(BackupFilesPresetEntry.SAVEDCONFIG, null); - Cache.log.debug("BACKUPFILESPRESETENTRY saved preset string is " - + savedPresetString); BackupFilesPresetEntry savedPreset = BackupFilesPresetEntry .createBackupFilesPresetEntry(savedPresetString); if (savedPreset == null)