Class LoggerAppenderRollingFile

Description

LoggerAppenderRollingFile writes logging events to a specified file. The file is rolled over after a specified size has been reached.

This appender uses a layout.

## Configurable parameters: ##

  • **file** - Path to the target file.
  • **append** - If set to true, the appender will append to the file, otherwise the file contents will be overwritten.
  • **maxBackupIndex** - Maximum number of backup files to keep. Default is 1.
  • **maxFileSize** - Maximum allowed file size (in bytes) before rolling over. Suffixes "KB", "MB" and "GB" are allowed. 10KB = 10240 bytes, etc. Default is 10M.
  • **compress** - If set to true, rolled-over files will be compressed. Requires the zlib extension.

Located in /log4php/appenders/LoggerAppenderRollingFile.php (line 45)

LoggerConfigurable
   |
   --LoggerAppender
      |
      --LoggerAppenderFile
         |
         --LoggerAppenderRollingFile
Class Constant Summary
Variable Summary
boolean $compress
integer $maxBackupIndex
integer $maxFileSize
Method Summary
LoggerAppenderRollingFile __construct ([ $name = ''])
void activateOptions ()
void getCompress (boolean 0)
integer getMaxBackupIndex ()
integer getMaxFileSize ()
integer getMaximumFileSize ()
void setCompress (boolean $compress)
void setMaxBackupIndex (integer $maxBackupIndex)
void setMaxFileSize (mixed $maxFileSize)
void setMaximumFileSize (mixed $maxFileSize)
void write (string $string)
Variables
boolean $compress = false (line 80)

The compress parameter determindes the compression with zlib.

If set to true, the rollover files are compressed and saved with the .gz extension.

  • access: protected
integer $maxBackupIndex = 1 (line 73)

Set the maximum number of backup files to keep around.

Determines how many backup files are kept before the oldest is erased. This option takes a positive integer value. If set to zero, then there will be no backup files and the log file will be truncated when it reaches maxFileSize.

There is one backup file by default.

  • access: protected
integer $maxFileSize = 10485760 (line 59)

The maximum size (in bytes) that the output file is allowed to reach before being rolled over to backup files.

The default maximum file size is 10MB (10485760 bytes). Maximum value for this option may depend on the file system.

  • access: protected

Inherited Variables

Inherited from LoggerAppenderFile

LoggerAppenderFile::$append
LoggerAppenderFile::$file
LoggerAppenderFile::$fp
LoggerAppenderFile::$locking

Inherited from LoggerAppender

LoggerAppender::$closed
LoggerAppender::$filter
LoggerAppender::$layout
LoggerAppender::$name
LoggerAppender::$requiresLayout
LoggerAppender::$threshold
Methods
Constructor __construct (line 99)
  • access: public
LoggerAppenderRollingFile __construct ([ $name = ''])
  • $name

Redefinition of:
LoggerAppender::__construct()
Default constructor.
activateOptions (line 239)
  • access: public
void activateOptions ()

Redefinition of:
LoggerAppenderFile::activateOptions()
getCompress (line 302)

Returns the 'compress' parameter.

  • access: public
void getCompress (boolean 0)
  • boolean 0
getMaxBackupIndex (line 260)

Returns the 'maxBackupIndex' parameter.

  • access: public
integer getMaxBackupIndex ()
getMaxFileSize (line 276)

Returns the 'maxFileSize' parameter.

  • access: public
integer getMaxFileSize ()
getMaximumFileSize (line 95)

Get the maximum size that the output file is allowed to reach before being rolled over to backup files.

  • access: public
integer getMaximumFileSize ()
setCompress (line 294)

Sets the 'compress' parameter.

  • access: public
void setCompress (boolean $compress)
  • boolean $compress
setMaxBackupIndex (line 252)

Set the 'maxBackupIndex' parameter.

  • access: public
void setMaxBackupIndex (integer $maxBackupIndex)
  • integer $maxBackupIndex
setMaxFileSize (line 268)

Set the 'maxFileSize' parameter.

  • access: public
void setMaxFileSize (mixed $maxFileSize)
  • mixed $maxFileSize
setMaximumFileSize (line 285)

Set the 'maxFileSize' parameter (kept for backward compatibility).

  • deprecated: Use setMaxFileSize() instead.
  • access: public
void setMaximumFileSize (mixed $maxFileSize)
  • mixed $maxFileSize
write (line 197)

Writes a string to the target file. Opens file if not already open.

  • access: protected
void write (string $string)
  • string $string: Data to write.

Redefinition of:
LoggerAppenderFile::write()
Writes a string to the target file. Opens file if not already open.

Inherited Methods

Inherited From LoggerAppenderFile

LoggerAppenderFile::activateOptions()
LoggerAppenderFile::append()
LoggerAppenderFile::close()
LoggerAppenderFile::getAppend()
LoggerAppenderFile::getFile()
LoggerAppenderFile::getFileName()
LoggerAppenderFile::getTargetFile()
LoggerAppenderFile::openFile()
LoggerAppenderFile::setAppend()
LoggerAppenderFile::setFile()
LoggerAppenderFile::setFileName()
LoggerAppenderFile::write()
LoggerAppenderFile::writeWithLocking()
LoggerAppenderFile::writeWithoutLocking()

Inherited From LoggerAppender

LoggerAppender::__construct()
LoggerAppender::activateOptions()
LoggerAppender::addFilter()
LoggerAppender::append()
LoggerAppender::clearFilters()
LoggerAppender::close()
LoggerAppender::doAppend()
LoggerAppender::getDefaultLayout()
LoggerAppender::getFilter()
LoggerAppender::getFirstFilter()
LoggerAppender::getLayout()
LoggerAppender::getName()
LoggerAppender::getThreshold()
LoggerAppender::isAsSevereAsThreshold()
LoggerAppender::requiresLayout()
LoggerAppender::setLayout()
LoggerAppender::setName()
LoggerAppender::setThreshold()
LoggerAppender::warn()
LoggerAppender::__destruct()

Inherited From LoggerConfigurable

LoggerConfigurable::setBoolean()
LoggerConfigurable::setFileSize()
LoggerConfigurable::setInteger()
LoggerConfigurable::setLevel()
LoggerConfigurable::setNumeric()
LoggerConfigurable::setPositiveInteger()
LoggerConfigurable::setString()
LoggerConfigurable::warn()
Class Constants
COMPRESS_CHUNK_SIZE = 102400 (line 48)

Compressing backup files is done in chunks, this determines how large.

Documentation generated on Tue, 12 Mar 2024 14:04:52 +0900 by phpDocumentor 1.4.4