org.jpos.util
Class RotateLogListener

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

public class RotateLogListener
extends SimpleLogListener
implements Configurable, Destroyable

Rotates logs

Since:
jPOS 1.2
Version:
$Revision$ $Date$
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(String logName, int sleepTime, int maxCopies)
           
RotateLogListener(String logName, int sleepTime, int maxCopies, long maxSize)
           
 
Method Summary
protected  void checkSize()
           
protected  void closeLogFile()
           
 void destroy()
           
 LogEvent log(LogEvent ev)
           
protected  void logDebug(String msg)
           
 void logRotate()
           
protected  void openLogFile()
           
 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
clone, equals, finalize, 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(String logName,
                         int sleepTime,
                         int maxCopies,
                         long maxSize)
                  throws IOException
Parameters:
name - base log filename
sleepTime - switch logs every t seconds
maxCopies - number of old logs
maxSize - in bytes
Throws:
IOException

RotateLogListener

public RotateLogListener(String logName,
                         int sleepTime,
                         int maxCopies)
                  throws IOException
Throws:
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

openLogFile

protected void openLogFile()
                    throws IOException
Throws:
IOException

closeLogFile

protected void closeLogFile()
                     throws IOException
Throws:
IOException

logRotate

public void logRotate()
               throws IOException
Throws:
IOException

logDebug

protected void logDebug(String msg)

checkSize

protected void checkSize()

destroy

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


Copyright © 1998-2012 jPOS.org. All Rights Reserved.