1 17 package org.apache.log.output.io.rotate; 18 19 import java.io.File ; 20 21 35 public class RotateStrategyBySize 36 implements RotateStrategy 37 { 38 private long m_maxSize; 39 private long m_currentSize; 40 41 45 public RotateStrategyBySize() 46 { 47 this( 1024 * 1024 ); 48 } 49 50 55 public RotateStrategyBySize( final long maxSize ) 56 { 57 m_currentSize = 0; 58 m_maxSize = maxSize; 59 } 60 61 64 public void reset() 65 { 66 m_currentSize = 0; 67 } 68 69 76 public boolean isRotationNeeded( final String data, final File file ) 77 { 78 m_currentSize += data.length(); 79 80 return m_currentSize >= m_maxSize; 81 } 82 } 83 84 | Popular Tags |