Package org.apache.log4j.helpers

Examples of org.apache.log4j.helpers.FileHelper.deleteExisting()


    GregorianCalendar currentDate = new GregorianCalendar();
    GregorianCalendar lastRelevantDate=getLastReleventDate(currentDate);
    for(int i=0;i<fileListSize;i++){
      File currentLogFile=(File)logFileList.get(i);
      if(!relevant(currentLogFile,lastRelevantDate)){
        fileHelper.deleteExisting(currentLogFile);
      }
    }
  }

  final LogFileList logFileList() {
View Full Code Here


      }
      long freed = 0L;
      for (int d = 0; d <= lastToBeDeleted; d++) {
        final File logFile = (File) logFileList.get(d);
        final long size = logFile.length();
        if (fileHelper.deleteExisting(logFile)) {
          LogLog.debug("Scavenged log file '" + logFile.getName()
              + "\', freed " + size + " bytes.");
          freed += size;
        }
      }
View Full Code Here

      final int toIndex = fileListSize - maxRollFileCount;
      final List subList = logFileList.subList(0, toIndex);
      final FileHelper fileHelper = FileHelper.getInstance();
      for (final Iterator iter = subList.iterator(); iter.hasNext();) {
        final File logFile = (File) iter.next();
        if (fileHelper.deleteExisting(logFile)) {
          LogLog.debug("Scavenged log file '" + logFile.getName() + '\'');
        }
      }
    }
  }
View Full Code Here

   * @param to
   *          The backup file.
   */
  private void doFileRoll(final File from, final File to) {
    final FileHelper fileHelper = FileHelper.getInstance();
    if (!fileHelper.deleteExisting(to)) {
      this.getAppender().getErrorHandler()
          .error("Unable to delete existing " + to + " for rename");
    }
    final String original = from.toString();
    if (fileHelper.rename(from, to)) {
View Full Code Here

  private File createDeflatedFile(final File backupFile) {
    try {
      final FileHelper fileHelper = FileHelper.getInstance();
      final File deflatedFile = new File(fileHelper.parentDirOf(backupFile),
          backupFile.getName() + '.' + this.getAlgorithmName());
      fileHelper.deleteExisting(deflatedFile);
      if (deflatedFile.createNewFile()) {
        return deflatedFile;
      } else {
        LogLog.warn("Unable to create compressed backup log file");
        return null;
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.