diff options
| author | Martin Ritchie <ritchiem@apache.org> | 2010-07-22 14:21:05 +0000 |
|---|---|---|
| committer | Martin Ritchie <ritchiem@apache.org> | 2010-07-22 14:21:05 +0000 |
| commit | 5d4b86fa9837492193f29c21d9dd3518fd6d06b3 (patch) | |
| tree | ed98510ed5770593038e1bfddcbe36c4b808918b /java/broker/src | |
| parent | 8dbbb9ad305ca936fb924420ec31e27e9a9d0caf (diff) | |
| download | qpid-python-5d4b86fa9837492193f29c21d9dd3518fd6d06b3.tar.gz | |
QPID-2739 : Updated deleteFile to add the backupFilesToPath for delete requests if it is set.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@966677 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/broker/src')
| -rw-r--r-- | java/broker/src/main/java/org/apache/log4j/QpidCompositeRollingAppender.java | 39 |
1 files changed, 36 insertions, 3 deletions
diff --git a/java/broker/src/main/java/org/apache/log4j/QpidCompositeRollingAppender.java b/java/broker/src/main/java/org/apache/log4j/QpidCompositeRollingAppender.java index be52b82789..1ad04af274 100644 --- a/java/broker/src/main/java/org/apache/log4j/QpidCompositeRollingAppender.java +++ b/java/broker/src/main/java/org/apache/log4j/QpidCompositeRollingAppender.java @@ -674,10 +674,43 @@ public class QpidCompositeRollingAppender extends FileAppender } } - /** Delete's the specified file if it exists */ - protected void deleteFile(String fileName) + /** + * Delete the given file that is prepended with the relative path to the log + * directory. + * + * Compress is enabled check for file with COMPRESS_EXTENSION(.gz) + * + * if backupFilesToPath is set then check in this directory not the + * main log directory. + */ + protected void deleteFile(String relativeFileName) { - File file = compress ? new File(fileName + COMPRESS_EXTENSION) : new File(fileName); + String fileName=""; + // If we have configured a backup location then we should look in there + // for the file we are trying to delete + if (backupFilesToPath != null) + { + int index = relativeFileName.lastIndexOf(File.separator); + if (index != -1) + { + fileName = backupFilesToPath + File.separator + + relativeFileName.substring(index); + } + else + { + fileName = relativeFileName; + } + } + + // If we are compressing the at the extension + if (compress) + { + fileName += COMPRESS_EXTENSION; + } + + + File file = new File(fileName); + if (file.exists()) { file.delete(); |
