summaryrefslogtreecommitdiff
path: root/qpid/java
diff options
context:
space:
mode:
authorMartin Ritchie <ritchiem@apache.org>2010-07-22 14:21:05 +0000
committerMartin Ritchie <ritchiem@apache.org>2010-07-22 14:21:05 +0000
commita5ef4c47edad45cf1e83cfc6d68afae6f78adf35 (patch)
tree4dd80ed8ffb9def0f48805472cbc7c5315ad9bf8 /qpid/java
parent28094213ff2f572d21b272853fd9063903564a7a (diff)
downloadqpid-python-a5ef4c47edad45cf1e83cfc6d68afae6f78adf35.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@966677 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java')
-rw-r--r--qpid/java/broker/src/main/java/org/apache/log4j/QpidCompositeRollingAppender.java39
1 files changed, 36 insertions, 3 deletions
diff --git a/qpid/java/broker/src/main/java/org/apache/log4j/QpidCompositeRollingAppender.java b/qpid/java/broker/src/main/java/org/apache/log4j/QpidCompositeRollingAppender.java
index be52b82789..1ad04af274 100644
--- a/qpid/java/broker/src/main/java/org/apache/log4j/QpidCompositeRollingAppender.java
+++ b/qpid/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();