unm.maui.misc
Class Logger

java.lang.Object
  extended byunm.maui.misc.Logger
All Implemented Interfaces:
java.util.EventListener, MauiListener, SchedListener, java.io.Serializable

public class Logger
extends java.lang.Object
implements SchedListener, java.io.Serializable

Maui logging and log-rotation.

See Also:
Serialized Form

Field Summary
protected  boolean doGzip
          Gzip backups?
static java.lang.String doGzipProperty
           
protected  java.lang.String emailAddress
          Address to send to.
protected  java.io.File errFile
          Log.err filename.
static java.lang.String logErrProperty
           
static java.lang.String logOutProperty
           
static java.lang.String logTokensProperty
           
protected  int numBackups
          Number of backup copies to make
static java.lang.String numBackupsProperty
           
protected  java.io.File outFile
          Log.out filename.
protected  java.lang.String prefix
          Properties prefix.
protected  long rotateSize
          Size (in bytes) to allow log to grow to before rotating.
static java.lang.String rotateSizeProperty
           
protected  boolean sendEmail
          Send email?
static java.lang.String sendEmailProperty
           
 
Constructor Summary
Logger()
          Construct
 
Method Summary
 void assignProperties(java.lang.String prefix, java.util.Properties props)
          Set properties.
 void event(SchedEvent evt)
          A Scheduler event.
static java.io.OutputStream rotateLog(java.io.File logFile, int numBackups, boolean doGzip)
          Rotate a log file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logOutProperty

public static final transient java.lang.String logOutProperty
See Also:
Constant Field Values

logErrProperty

public static final transient java.lang.String logErrProperty
See Also:
Constant Field Values

logTokensProperty

public static final transient java.lang.String logTokensProperty
See Also:
Constant Field Values

rotateSizeProperty

public static final transient java.lang.String rotateSizeProperty
See Also:
Constant Field Values

numBackupsProperty

public static final transient java.lang.String numBackupsProperty
See Also:
Constant Field Values

doGzipProperty

public static final transient java.lang.String doGzipProperty
See Also:
Constant Field Values

sendEmailProperty

public static final transient java.lang.String sendEmailProperty
See Also:
Constant Field Values

outFile

protected transient java.io.File outFile
Log.out filename.


errFile

protected transient java.io.File errFile
Log.err filename.


rotateSize

protected transient long rotateSize
Size (in bytes) to allow log to grow to before rotating.


numBackups

protected transient int numBackups
Number of backup copies to make


doGzip

protected transient boolean doGzip
Gzip backups?


sendEmail

protected transient boolean sendEmail
Send email?


emailAddress

protected transient java.lang.String emailAddress
Address to send to.


prefix

protected java.lang.String prefix
Properties prefix.

Constructor Detail

Logger

public Logger()
Construct

Method Detail

rotateLog

public static java.io.OutputStream rotateLog(java.io.File logFile,
                                             int numBackups,
                                             boolean doGzip)
                                      throws java.io.FileNotFoundException,
                                             java.io.IOException
Rotate a log file.

Parameters:
logFile - Main log file to rotate
numBackups - number of backups to rotate (last one gets rotated off the end)
doGzip - (gzip the log?)
Returns:
OutputStream new stream to print to
Throws:
java.io.FileNotFoundException
java.io.IOException

assignProperties

public void assignProperties(java.lang.String prefix,
                             java.util.Properties props)
Set properties.

Specified by:
assignProperties in interface MauiListener
Parameters:
prefix - String properties prefix
props - Properties

event

public void event(SchedEvent evt)
Description copied from interface: SchedListener
A Scheduler event.

Specified by:
event in interface SchedListener
Parameters:
evt - SchedEvent
See Also:
SchedListener.event(unm.maui.sched.SchedEvent)