Class FileLog
File Storage stream for Logging. Writes logs to different files based on the type of log it is.
- BaseLog implements CakeLogInterface
-
FileLog
Package: Cake\Log\Engine
Copyright: Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
License: MIT License
Location: Cake/Log/Engine/FileLog.php
Copyright: Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
License: MIT License
Location: Cake/Log/Engine/FileLog.php
Properties summary
-
$_defaultsprotectedarrayDefault configuration values -
$_fileprotectedstringLog file name -
$_pathprotectedstringPath to save log files on. -
$_sizeprotectedintegerMax file size, used for log file rotation.
Inherited Properties
Method Summary
-
__construct() public
Constructs a new File Logger. -
_getFilename() protected
Get filename -
_rotateFile() protected
Rotate log file if size specified in config is reached. Also if
rotatecount is reached oldest file is removed. -
config() public
Sets protected properties based on config provided -
write() public
Implements writing to log files.
Method Detail
__construct() public ¶
__construct( array $config = array() )
Constructs a new File Logger.
Config
typesstring or array, levels the engine is interested inscopesstring or array, scopes the engine is interested infileLog file namepathThe path to save logs on.sizeUsed to implement basic log file rotation. If log file size reaches specified size the existing file is renamed by appending timestamp to filename and new log file is created. Can be integer bytes value or human reabable string values like '10MB', '100KB' etc.rotateLog files are rotated specified times before being removed. If value is 0, old versions are removed rather then rotated.maskA mask is applied when log files are created. Left empty no chmod is made.
Parameters
- array $config optional array()
- Options for the FileLog, see above.
Overrides
_getFilename() protected ¶
_getFilename( string $type )
Get filename
Parameters
- string $type
- The type of log.
Returns
string
File name
File name
_rotateFile() protected ¶
_rotateFile( string $filename )
Rotate log file if size specified in config is reached.
Also if rotate count is reached oldest file is removed.
Parameters
- string $filename
- Log file name
Returns
mixed
True if rotated successfully or false in case of error, otherwise null. Void if file doesn't need to be rotated.
Properties detail
$_defaults ¶
protected
array
Default configuration values
See
FileLog::__construct()
array( 'path' => LOGS, 'file' => null, 'types' => null, 'scopes' => array(), 'rotate' => 10, 'size' => 10485760, // 10MB 'mask' => null, )