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[]
{
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));
}
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");
{
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,
}
else
{
- Cache.log.debug(
+ Cache.log.trace(
"BACKUPFILES [file==null] attempting to create default temp file "
+ DEFAULT_TEMP_FILE + " with extension "
+ TEMP_FILE_EXT);
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)
return true;
}
- Cache.log.debug("BACKUPFILES rollBackupFiles starting");
+ Cache.log.trace("BACKUPFILES rollBackupFiles starting");
String dir = "";
File dirFile;
{
dirFile = file.getParentFile();
dir = dirFile.getCanonicalPath();
- Cache.log.debug("BACKUPFILES dir: " + dir);
+ Cache.log.trace("BACKUPFILES dir: " + dir);
} catch (Exception e)
{
Cache.log.error(
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
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;
}
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
// 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;
}
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
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 "
}
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.
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
File fileToBeDeleted = backupFiles[i];
boolean delete = true;
- Cache.log.debug(
+ Cache.log.trace(
"BACKUPFILES fileToBeDeleted: " + fileToBeDeleted);
boolean newer = false;
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)
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() + "'");
}
}
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 '"