atg.nucleus.logging
Class RotatingFileLogger

java.lang.Object
  extended by atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
      extended by atg.nucleus.GenericService
          extended by atg.nucleus.logging.DisplayLogger
              extended by atg.nucleus.logging.FileLogger
                  extended by atg.nucleus.logging.RotatingFileLogger
All Implemented Interfaces:
NameContextBindingListener, NameContextElement, NameResolver, AdminableService, ApplicationLogging, atg.nucleus.logging.ApplicationLoggingSender, LogListener, atg.nucleus.logging.TraceApplicationLogging, atg.nucleus.logging.VariableArgumentApplicationLogging, ComponentNameResolver, Service, ServiceListener, Schedulable, java.util.EventListener

public class RotatingFileLogger
extends FileLogger
implements Schedulable

This subclass of FileLogger will "rotate" logs according to a schedule. When the logs are rotated, the current log is compressed, "zipped", and written to the logArchivePath, with the name "{logfile}.0.zip". If there is already a "{logfile}.0.zip" in existence, then it is renamed to "{logfile}.1.zip", and so on. A maximum archive count specifies the highest numbered log file to be stored, after which the oldest archive files are removed.

Log files are only "zipped" if the "archiveCompressed" flag is set to true. Otherwise, the log files are copied as-is, and do not have the ".zip" extension.


Field Summary
static java.lang.String CLASS_VERSION
          Class version string
 
Fields inherited from class atg.nucleus.logging.FileLogger
mLogFileName, mLogFilePath
 
Fields inherited from class atg.nucleus.GenericService
SERVICE_INFO_KEY
 
Fields inherited from interface atg.nucleus.logging.TraceApplicationLogging
DEFAULT_LOG_TRACE_STATUS
 
Fields inherited from interface atg.nucleus.logging.ApplicationLogging
DEFAULT_LOG_DEBUG_STATUS, DEFAULT_LOG_ERROR_STATUS, DEFAULT_LOG_INFO_STATUS, DEFAULT_LOG_WARNING_STATUS
 
Constructor Summary
RotatingFileLogger()
          Constructs a new RotatingFileLogger
 
Method Summary
 void doStartService()
          Schedules the rotation
 void doStopService()
          Unschedules the rotation
 java.io.File getLogArchivePath()
          Returns the path used to store rotated log archives
 int getMaximumArchiveCount()
          Returns the maximum number of archived files that will be kept for this file.
 Schedule getSchedule()
          Returns the Schedule that is used to schedule rotations
 Scheduler getScheduler()
          Returns the Scheduler that is used to schedule rotations
 boolean isArchiveCompressed()
          Returns the flag indicating if the archive files are compressed when rotated.
 void performScheduledTask(Scheduler pScheduler, ScheduledJob pJob)
          Performs the log rotation
 void rotateCompressedLogs()
          Rotates the compressed log files
 void rotateLogs()
          Rotates the log files
 void rotateUncompressedLogs()
          Rotates the uncompressed log files
 void setArchiveCompressed(boolean pArchiveCompressed)
          Sets the flag indicating if the archive files are compressed when rotated.
 void setLogArchivePath(java.io.File pLogArchivePath)
          Sets the path used to store rotated log archives
 void setMaximumArchiveCount(int pMaximumArchiveCount)
          Sets the maximum number of archived files that will be kept for this file.
 void setSchedule(Schedule pSchedule)
          Sets the Schedule that is used to schedule rotations
 void setScheduler(Scheduler pScheduler)
          Sets the Scheduler that is used to schedule rotations
 
Methods inherited from class atg.nucleus.logging.FileLogger
close, flush, getLogFileName, getLogFilePath, open, setLogFileName, setLogFilePath
 
Methods inherited from class atg.nucleus.logging.DisplayLogger
generateCroppedStackTrace, getLoggingEnabled, getLogStream, getMaxLinesInStackTrace, getPrefixLogStream, getPrintStackTrace, getWrittenEventCount, isCropStackTrace, isPrefixEachLine, isPrefixEachMessage, isSuppressTimestamp, logEvent, setCropStackTrace, setLoggingEnabled, setLogStream, setMaxLinesInStackTrace, setPrefixEachLine, setPrefixEachMessage, setPrefixLogStream, setPrintStackTrace, setSuppressTimestamp, writeLogEvent
 
Methods inherited from class atg.nucleus.GenericService
addLogListener, createAdminServlet, getAbsoluteName, getAdminServlet, getLoggingForVlogging, getLogListenerCount, getLogListeners, getName, getNameContext, getNucleus, getRoot, getServiceConfiguration, getServiceInfo, isLoggingDebug, isLoggingError, isLoggingInfo, isLoggingTrace, isLoggingWarning, isRunning, logDebug, logDebug, logDebug, logError, logError, logError, logInfo, logInfo, logInfo, logTrace, logTrace, logTrace, logWarning, logWarning, logWarning, nameContextElementBound, nameContextElementUnbound, removeLogListener, resolveName, resolveName, resolveName, resolveName, sendLogEvent, setLoggingDebug, setLoggingError, setLoggingInfo, setLoggingTrace, setLoggingWarning, setNucleus, setServiceInfo, startService, stopService
 
Methods inherited from class atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
vlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogError, vlogError, vlogError, vlogError, vlogInfo, vlogInfo, vlogInfo, vlogInfo, vlogTrace, vlogTrace, vlogTrace, vlogTrace, vlogWarning, vlogWarning, vlogWarning, vlogWarning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLASS_VERSION

public static java.lang.String CLASS_VERSION
Class version string

Constructor Detail

RotatingFileLogger

public RotatingFileLogger()
Constructs a new RotatingFileLogger

Method Detail

getScheduler

public Scheduler getScheduler()
Returns the Scheduler that is used to schedule rotations


setScheduler

public void setScheduler(Scheduler pScheduler)
Sets the Scheduler that is used to schedule rotations


getSchedule

public Schedule getSchedule()
Returns the Schedule that is used to schedule rotations


setSchedule

public void setSchedule(Schedule pSchedule)
Sets the Schedule that is used to schedule rotations


getLogArchivePath

public java.io.File getLogArchivePath()
Returns the path used to store rotated log archives


setLogArchivePath

public void setLogArchivePath(java.io.File pLogArchivePath)
Sets the path used to store rotated log archives


getMaximumArchiveCount

public int getMaximumArchiveCount()
Returns the maximum number of archived files that will be kept for this file.


setMaximumArchiveCount

public void setMaximumArchiveCount(int pMaximumArchiveCount)
Sets the maximum number of archived files that will be kept for this file.


isArchiveCompressed

public boolean isArchiveCompressed()
Returns the flag indicating if the archive files are compressed when rotated.


setArchiveCompressed

public void setArchiveCompressed(boolean pArchiveCompressed)
Sets the flag indicating if the archive files are compressed when rotated.


doStartService

public void doStartService()
                    throws ServiceException
Schedules the rotation

Overrides:
doStartService in class FileLogger
Throws:
ServiceException - if an error occurred during the operation

doStopService

public void doStopService()
                   throws ServiceException
Unschedules the rotation

Overrides:
doStopService in class FileLogger
Throws:
ServiceException - if an error occurred during the operation

performScheduledTask

public void performScheduledTask(Scheduler pScheduler,
                                 ScheduledJob pJob)
Performs the log rotation

Specified by:
performScheduledTask in interface Schedulable
Parameters:
pScheduler - calling the job
pJob - the ScheduledJob

rotateLogs

public void rotateLogs()
Rotates the log files


rotateUncompressedLogs

public void rotateUncompressedLogs()
Rotates the uncompressed log files


rotateCompressedLogs

public void rotateCompressedLogs()
Rotates the compressed log files