Overview

Packages

  • log4php
    • appenders
    • configurators
    • filters
    • helpers
    • layouts
    • pattern
    • renderers

Classes

  • LoggerAppenderConsole
  • LoggerAppenderDailyFile
  • LoggerAppenderEcho
  • LoggerAppenderFile
  • LoggerAppenderFirePHP
  • LoggerAppenderMail
  • LoggerAppenderMailEvent
  • LoggerAppenderMongoDB
  • LoggerAppenderNull
  • LoggerAppenderPDO
  • LoggerAppenderPhp
  • LoggerAppenderRollingFile
  • LoggerAppenderSocket
  • LoggerAppenderSyslog
  • Overview
  • Package
  • Class
  • Tree

Class LoggerAppenderRollingFile

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.
LoggerConfigurable
Extended by LoggerAppender
Extended by LoggerAppenderFile
Extended by LoggerAppenderRollingFile
Package: log4php\appenders
License: Apache License, Version 2.0
Version: $Revision: 1394975 $
Link: Appender documentation
Located at appenders/LoggerAppenderRollingFile.php
Methods summary
public integer
# getMaximumFileSize( )

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

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

Returns

integer
public
# __construct( string $name = '' )

Default constructor.

Default constructor.

Parameters

$name
string
$name Appender name

Overrides

LoggerAppender::__construct()
protected
# write( string $string )

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

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

Parameters

$string
string
$string Data to write.

Overrides

LoggerAppenderFile::write()
public
# activateOptions( )

Prepares the appender for logging.

Prepares the appender for logging.

Derived appenders should override this method if option structure requires it.

Overrides

LoggerAppenderFile::activateOptions()
public
# setMaxBackupIndex( integer $maxBackupIndex )

Set the 'maxBackupIndex' parameter.

Set the 'maxBackupIndex' parameter.

Parameters

$maxBackupIndex
integer
$maxBackupIndex
public integer
# getMaxBackupIndex( )

Returns the 'maxBackupIndex' parameter.

Returns the 'maxBackupIndex' parameter.

Returns

integer
public
# setMaxFileSize( mixed $maxFileSize )

Set the 'maxFileSize' parameter.

Set the 'maxFileSize' parameter.

Parameters

$maxFileSize
mixed
$maxFileSize
public integer
# getMaxFileSize( )

Returns the 'maxFileSize' parameter.

Returns the 'maxFileSize' parameter.

Returns

integer
public
# setCompress( boolean $compress )

Sets the 'compress' parameter.

Sets the 'compress' parameter.

Parameters

$compress
boolean
$compress
public
# getCompress( )

Returns the 'compress' parameter.

Returns the 'compress' parameter.

Methods inherited from LoggerAppenderFile
append(), close(), getAppend(), getFile(), getTargetFile(), openFile(), setAppend(), setFile(), writeWithLocking(), writeWithoutLocking()
Methods inherited from LoggerAppender
__destruct(), addFilter(), clearFilters(), doAppend(), getDefaultLayout(), getFilter(), getFirstFilter(), getLayout(), getName(), getThreshold(), isAsSevereAsThreshold(), requiresLayout(), setLayout(), setName(), setThreshold(), warn()
Methods inherited from LoggerConfigurable
setBoolean(), setFileSize(), setInteger(), setLevel(), setNumeric(), setPositiveInteger(), setString()
Constants summary
integer COMPRESS_CHUNK_SIZE 102400
#

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

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

Properties summary
protected integer $maxFileSize 10485760
#

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

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.

protected integer $maxBackupIndex 1
#

Set the maximum number of backup files to keep around.

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.

protected boolean $compress false
#

The compress parameter determindes the compression with zlib. If set to true, the rollover files are compressed and saved with the .gz extension.

The compress parameter determindes the compression with zlib. If set to true, the rollover files are compressed and saved with the .gz extension.

Properties inherited from LoggerAppenderFile
$append, $file, $fp, $locking
Properties inherited from LoggerAppender
$closed, $filter, $layout, $name, $requiresLayout, $threshold
Apache log4php API documentation generated by ApiGen 2.8.0