ariba.util.log
Class ArchivingAppender

java.lang.Object
  extended by org.apache.log4j.AppenderSkeleton
      extended by org.apache.log4j.WriterAppender
          extended by org.apache.log4j.FileAppender
              extended by ariba.util.log.ArchivingAppender
All Implemented Interfaces:
org.apache.log4j.Appender, org.apache.log4j.spi.OptionHandler
Direct Known Subclasses:
ZipArchivingAppender

public class ArchivingAppender
extends org.apache.log4j.FileAppender

This class extends org.apache.log4j.FileAppender to provide archiving support. It allows one to optionally specify the name of the directory of the file to archive and the archiving directory where the acrhived file will reside.


Field Summary
static java.lang.String ArchiveDirectoryNameKey
          Property for where the log file will be archive to
static java.lang.String DefaultEncoding
          The default encoding to be used.
static java.lang.String DirectoryNameKey
          Property for what the directory of the log file will be
static java.lang.String LogFileNameKey
          Property for what the name of the log file will be
static java.lang.String MaxArchiveSizeKey
          Property for how large the archive directory can grow before being pruned.
 
Constructor Summary
ArchivingAppender()
          Construct an ArchivingAppender.
 
Method Summary
 void activateOptions()
          Active the options set for this class.
 void archiveLogFile()
          Archive the currently opened log file
 java.lang.String getArchiveDirectoryName()
           
 java.lang.String getDirectoryName()
          Returns the directory for the log file.
static java.util.Iterator getIteratorForAppenders()
           
 java.lang.String getLastArchivedFileName()
          Gets the name of the most recent archived log file.
 java.lang.String getMaxArchiveSize()
           
 boolean initLogDirectories()
          Create the standard directories that are needed for logging information from the specified Ariba product.
 void monitorDirectories()
           
 void removeFromAllInstances()
          Removes this ArchivingAppender from the list of allInstances.
 void setArchiveDirectoryName(java.lang.String archiveDirectoryName)
          Set the archive directory for the log file.
 void setDirectoryName(java.lang.String directoryName)
          Set the directory for the log file, should be called prior to calling #activateOptions.
 void setMaxArchiveSize(java.lang.String maxArchiveSize)
          Set the max archive directory size
 
Methods inherited from class org.apache.log4j.FileAppender
getAppend, getBufferedIO, getBufferSize, getFile, setAppend, setBufferedIO, setBufferSize, setFile, setFile
 
Methods inherited from class org.apache.log4j.WriterAppender
append, close, getEncoding, getImmediateFlush, requiresLayout, setEncoding, setErrorHandler, setImmediateFlush, setWriter
 
Methods inherited from class org.apache.log4j.AppenderSkeleton
addFilter, clearFilters, doAppend, finalize, getErrorHandler, getFilter, getFirstFilter, getLayout, getName, getThreshold, isAsSevereAsThreshold, setLayout, setName, setThreshold
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LogFileNameKey

public static final java.lang.String LogFileNameKey
Property for what the name of the log file will be

See Also:
Constant Field Values

DirectoryNameKey

public static final java.lang.String DirectoryNameKey
Property for what the directory of the log file will be

See Also:
Constant Field Values

ArchiveDirectoryNameKey

public static final java.lang.String ArchiveDirectoryNameKey
Property for where the log file will be archive to

See Also:
Constant Field Values

MaxArchiveSizeKey

public static final java.lang.String MaxArchiveSizeKey
Property for how large the archive directory can grow before being pruned.

See Also:
Constant Field Values

DefaultEncoding

public static final java.lang.String DefaultEncoding
The default encoding to be used.

See Also:
Constant Field Values
Constructor Detail

ArchivingAppender

public ArchivingAppender()
Construct an ArchivingAppender.

Method Detail

getIteratorForAppenders

public static java.util.Iterator getIteratorForAppenders()
Returns:
an iterator of all ArchivingAppender instances

removeFromAllInstances

public void removeFromAllInstances()
Removes this ArchivingAppender from the list of allInstances.


getLastArchivedFileName

public java.lang.String getLastArchivedFileName()
Gets the name of the most recent archived log file.

Returns:
name of most recent archived log file

setDirectoryName

public void setDirectoryName(java.lang.String directoryName)
Set the directory for the log file, should be called prior to calling #activateOptions. Note that this is not synchronized, the last caller wins.

Parameters:
directoryName - directory as String

getDirectoryName

public java.lang.String getDirectoryName()
Returns the directory for the log file.

Returns:
the directory for the log file.

setArchiveDirectoryName

public void setArchiveDirectoryName(java.lang.String archiveDirectoryName)
Set the archive directory for the log file. Should be called prior to calling #activateOptions. Note that this is not synchronized, the last caller wins.

Parameters:
archiveDirectoryName - directory as String

getArchiveDirectoryName

public java.lang.String getArchiveDirectoryName()
Returns:
the archive directory for the log file

setMaxArchiveSize

public void setMaxArchiveSize(java.lang.String maxArchiveSize)
Set the max archive directory size

Parameters:
maxArchiveSize - size in mega bytes

getMaxArchiveSize

public java.lang.String getMaxArchiveSize()
Returns:
max archive directory size

archiveLogFile

public void archiveLogFile()
Archive the currently opened log file


initLogDirectories

public boolean initLogDirectories()
Create the standard directories that are needed for logging information from the specified Ariba product.

Returns:
a boolean value representing whether the initialization was sucessful.

monitorDirectories

public void monitorDirectories()

activateOptions

public void activateOptions()
Active the options set for this class. The log file is created when this method is executed.

Specified by:
activateOptions in interface org.apache.log4j.spi.OptionHandler
Overrides:
activateOptions in class org.apache.log4j.FileAppender


AribaWeb User Interface Development Framework
Copyright © 2000-2014 Ariba, Inc. All Rights Reserved.