Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*     */ package org.apache.log4j;
  /*     */ 
  /*     */ import java.io.File;
  /*     */ import java.io.IOException;
  /*     */ import java.io.Writer;
  /*     */ import org.apache.log4j.helpers.LogLog;
  /*     */ import org.apache.log4j.helpers.OptionConverter;
  /*     */ import org.apache.log4j.spi.LoggingEvent;
 /*     */ 
 /*     */ public class RollingFileAppender extends FileAppender
 /*     */ {
 /*  42 */   protected long maxFileSize = 10485760L;
 /*     */ 
 /*  47 */   protected int maxBackupIndex = 1;
 /*     */ 
 /*     */   public RollingFileAppender()
 /*     */   {
 /*     */   }
 /*     */ 
 /*     */   public RollingFileAppender(Layout layoutString filenameboolean append)
 /*     */     throws IOException
 /*     */   {
 /*  69 */     super(layoutfilenameappend);
 /*     */   }
 /*     */ 
 /*     */   public RollingFileAppender(Layout layoutString filename)
 /*     */     throws IOException
 /*     */   {
 /*  80 */     super(layoutfilename);
 /*     */   }
 /*     */ 
 /*     */   public int getMaxBackupIndex()
 /*     */   {
 /*  88 */     return this.;
 /*     */   }
 /*     */ 
 /*     */   public long getMaximumFileSize()
 /*     */   {
 /*  99 */     return this.;
 /*     */   }
 /*     */ 
 /*     */   public void rollOver()
 /*     */   {
 /* 121 */     if (this. != null) {
 /* 122 */       LogLog.debug("rolling over count=" + ((CountingQuietWriter)this.).getCount());
 /*     */     }
 /* 124 */     LogLog.debug("maxBackupIndex=" + this.);
 /*     */ 
 /* 127 */     if (this. > 0)
 /*     */     {
 /* 129 */       File file = new File(this. + '.' + this.);
 /* 130 */       if (file.exists()) {
 /* 131 */         file.delete();
 /*     */       }
 /*     */ 
 /* 134 */       for (int i = this. - 1; i >= 1; i--) {
 /* 135 */         file = new File(this. + "." + i);
 /* 136 */         if (file.exists()) {
 /* 137 */           File target = new File(this. + '.' + (i + 1));
 /* 138 */           LogLog.debug("Renaming file " + file + " to " + target);
 /* 139 */           file.renameTo(target);
 /*     */         }
 /*     */ 
 /*     */       }
 /*     */ 
 /* 144 */       File target = new File(this. + "." + 1);
 /*     */ 
 /* 146 */       closeFile();
 /*     */ 
 /* 148 */       file = new File(this.);
 /* 149 */       LogLog.debug("Renaming file " + file + " to " + target);
 /* 150 */       file.renameTo(target);
 /*     */     }
 /*     */ 
 /*     */     try
 /*     */     {
 /* 156 */       setFile(this.falsethis.this.);
 /*     */     }
 /*     */     catch (IOException e) {
 /* 159 */       LogLog.error("setFile(" + this. + ", false) call failed."e);
 /*     */     }
 /*     */   }
 /*     */ 
 /*     */   public synchronized void setFile(String fileNameboolean appendboolean bufferedIOint bufferSize)
 /*     */     throws IOException
 /*     */   {
 /* 167 */     super.setFile(fileName, append, this.bufferedIO, this.);
 /* 168 */     if (append) {
 /* 169 */       File f = new File(fileName);
 /* 170 */       ((CountingQuietWriter)this.).setCount(f.length());
 /*     */     }
 /*     */   }
 /*     */ 
 /*     */   public void setMaxBackupIndex(int maxBackups)
 /*     */   {
 /* 186 */     this. = maxBackups;
 /*     */   }
 /*     */ 
/*     */   public void setMaximumFileSize(long maxFileSize)
/*     */   {
/* 203 */     this. = maxFileSize;
/*     */   }
/*     */ 
/*     */   public void setMaxFileSize(String value)
/*     */   {
/* 220 */     this. = OptionConverter.toFileSize(valuethis. + 1L);
/*     */   }
/*     */ 
/*     */   protected void setQWForFiles(Writer writer)
/*     */   {
/* 225 */     this. = new CountingQuietWriter(writerthis.);
/*     */   }
/*     */ 
/*     */   protected void subAppend(LoggingEvent event)
/*     */   {
/* 236 */     super.subAppend(event);
/* 237 */     if ((this. != null) && (((CountingQuietWriter)this.).getCount() >= this.))
/*     */     {
/* 239 */       rollOver();
/*     */     }
/*     */   }
/*     */ }
/* Location:           /home/mnovotny/projects/EMBEDDED_JBOSS_BETA3_COMMUNITY/embedded/output/lib/embedded-jboss/lib/thirdparty-all.jar
 * Qualified Name:     org.apache.log4j.RollingFileAppender
 * JD-Core Version:    0.6.0
 */
New to GrepCode? Check out our FAQ X