jPOS 1.6.1 API Documentation

org.jpos.util
Class RotateLogListener

java.lang.Object
  extended by org.jpos.util.SimpleLogListener
      extended by org.jpos.util.RotateLogListener
All Implemented Interfaces:
java.util.EventListener, Configurable, Destroyable, LogListener
Direct Known Subclasses:
DailyLogListener

public class RotateLogListener
extends SimpleLogListener
implements Configurable, Destroyable

Rotates logs

Since:
jPOS 1.2
Version:
$Revision: 2594 $ $Date: 2008-01-22 08:41:31 -0800 (Tue, 22 Jan 2008) $
Author:
Alejandro P. Revilla
See Also:
Configurable

Nested Class Summary
 class RotateLogListener.Rotate
           
 
Field Summary
static int CHECK_INTERVAL
           
static long DEFAULT_MAXSIZE
           
 
Constructor Summary
RotateLogListener()
           
RotateLogListener(java.lang.String logName, int sleepTime, int maxCopies)
           
RotateLogListener(java.lang.String logName, int sleepTime, int maxCopies, long maxSize)
           
 
Method Summary
 void destroy()
           
 LogEvent log(LogEvent ev)
           
 void logRotate()
           
 void setConfiguration(Configuration cfg)
          Configure this RotateLogListener
Properties:
file base log filename [window] in seconds (default 0 - never rotate) [count] number of copies (default 0 == single copy) [maxsize] max log size in bytes (aprox)
 
Methods inherited from class org.jpos.util.SimpleLogListener
close, setPrintStream
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CHECK_INTERVAL

public static final int CHECK_INTERVAL
See Also:
Constant Field Values

DEFAULT_MAXSIZE

public static final long DEFAULT_MAXSIZE
See Also:
Constant Field Values
Constructor Detail

RotateLogListener

public RotateLogListener(java.lang.String logName,
                         int sleepTime,
                         int maxCopies,
                         long maxSize)
                  throws java.io.IOException
Parameters:
name - base log filename
sleepTime - switch logs every t seconds
maxCopies - number of old logs
maxSize - in bytes
Throws:
java.io.IOException

RotateLogListener

public RotateLogListener(java.lang.String logName,
                         int sleepTime,
                         int maxCopies)
                  throws java.io.IOException
Throws:
java.io.IOException

RotateLogListener

public RotateLogListener()
Method Detail

setConfiguration

public void setConfiguration(Configuration cfg)
                      throws ConfigurationException
Configure this RotateLogListener
Properties:

Specified by:
setConfiguration in interface Configurable
Parameters:
cfg - Configuration
Throws:
ConfigurationException

log

public LogEvent log(LogEvent ev)
Specified by:
log in interface LogListener
Overrides:
log in class SimpleLogListener

logRotate

public void logRotate()
               throws java.io.IOException
Throws:
java.io.IOException

destroy

public void destroy()
Specified by:
destroy in interface Destroyable

jPOS.org