PHP Class yii\log\FileTarget

The log file is specified via [[logFile]]. If the size of the log file exceeds [[maxFileSize]] (in kilo-bytes), a rotation will be performed, which renames the current log file by suffixing the file name with '.1'. All existing log files are moved backwards by one place, i.e., '.2' to '.3', '.1' to '.2', and so on. The property [[maxLogFiles]] specifies how many history files to keep.
Since: 2.0
Author: Qiang Xue ([email protected])
Inheritance: extends Target
Afficher le fichier Open project: yiisoft/yii2 Class Usage Examples

Méthodes publiques

Свойство Type Description
$dirMode the permission to be set for newly created directories. This value will be used by PHP chmod() function. No umask will be applied. Defaults to 0775, meaning the directory is read-writable by owner and group, but read-only for other users.
$enableRotation whether log files should be rotated when they reach a certain [[maxFileSize|maximum size]]. Log rotation is enabled by default. This property allows you to disable it, when you have configured an external tools for log rotation on your server.
$fileMode the permission to be set for newly created log files. This value will be used by PHP chmod() function. No umask will be applied. If not set, the permission will be determined by the current environment.
$logFile log file path or path alias. If not set, it will use the "@runtime/logs/app.log" file. The directory containing the log files will be automatically created if not existing.
$maxFileSize maximum log file size, in kilo-bytes. Defaults to 10240, meaning 10MB.
$maxLogFiles number of log files used for rotation. Defaults to 5.
$rotateByCopy Whether to rotate log files by copy and truncate in contrast to rotation by renaming files. Defaults to true to be more compatible with log tailers and is windows systems which do not play well with rename on open files. Rotation by renaming however is a bit faster. The problem with windows systems where the rename() function does not work with files that are opened by some process is described in a comment by Martin Pelletier in the PHP documentation. By setting rotateByCopy to true you can work around this problem.

Méthodes publiques

Méthode Description
export ( ) Writes log messages to a file.
init ( ) Initializes the route.

Méthodes protégées

Méthode Description
rotateFiles ( ) Rotates log files.

Method Details

export() public méthode

Writes log messages to a file.
public export ( )

init() public méthode

This method is invoked after the route is created by the route manager.
public init ( )

rotateFiles() protected méthode

Rotates log files.
protected rotateFiles ( )

Property Details

$dirMode public_oe property

the permission to be set for newly created directories. This value will be used by PHP chmod() function. No umask will be applied. Defaults to 0775, meaning the directory is read-writable by owner and group, but read-only for other users.
public $dirMode

$enableRotation public_oe property

whether log files should be rotated when they reach a certain [[maxFileSize|maximum size]]. Log rotation is enabled by default. This property allows you to disable it, when you have configured an external tools for log rotation on your server.
Since: 2.0.3
public $enableRotation

$fileMode public_oe property

the permission to be set for newly created log files. This value will be used by PHP chmod() function. No umask will be applied. If not set, the permission will be determined by the current environment.
public $fileMode

$logFile public_oe property

log file path or path alias. If not set, it will use the "@runtime/logs/app.log" file. The directory containing the log files will be automatically created if not existing.
public $logFile

$maxFileSize public_oe property

maximum log file size, in kilo-bytes. Defaults to 10240, meaning 10MB.
public $maxFileSize

$maxLogFiles public_oe property

number of log files used for rotation. Defaults to 5.
public $maxLogFiles

$rotateByCopy public_oe property

Whether to rotate log files by copy and truncate in contrast to rotation by renaming files. Defaults to true to be more compatible with log tailers and is windows systems which do not play well with rename on open files. Rotation by renaming however is a bit faster. The problem with windows systems where the rename() function does not work with files that are opened by some process is described in a comment by Martin Pelletier in the PHP documentation. By setting rotateByCopy to true you can work around this problem.
public $rotateByCopy