PHP Класс 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.
С версии: 2.0
Автор: Qiang Xue ([email protected])
Наследование: extends Target
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$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.

Открытые методы

Метод Описание
export ( ) Writes log messages to a file.
init ( ) Initializes the route.

Защищенные методы

Метод Описание
rotateFiles ( ) Rotates log files.

Описание методов

export() публичный Метод

Writes log messages to a file.
public export ( )

init() публичный Метод

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

rotateFiles() защищенный Метод

Rotates log files.
protected rotateFiles ( )

Описание свойств

$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.
public $dirMode

$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.
С версии: 2.0.3
public $enableRotation

$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.
public $fileMode

$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.
public $logFile

$maxFileSize публичное свойство

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

$maxLogFiles публичное свойство

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

$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.
public $rotateByCopy