CakePHP
  • Documentation
    • Book
    • API
    • Videos
    • Reporting Security Issues
    • Privacy Policy
    • Logos & Trademarks
  • Business Solutions
  • Swag
  • Road Trip
  • Team
  • Community
    • Community
    • Get Involved
    • Issues (GitHub)
    • Bakery
    • Featured Resources
    • Training
    • Meetups
    • My CakePHP
    • CakeFest
    • Newsletter
    • Linkedin
    • YouTube
    • Facebook
    • Twitter
    • Mastodon
    • Help & Support
    • Forum
    • Stack Overflow
    • Slack
    • Paid Support
CakePHP

C CakePHP 2.6 API

  • Overview
  • Tree
  • Deprecated
  • Version:
    • 2.6
      • 4.2
      • 4.1
      • 4.0
      • 3.9
      • 3.8
      • 3.7
      • 3.6
      • 3.5
      • 3.4
      • 3.3
      • 3.2
      • 3.1
      • 3.0
      • 2.10
      • 2.9
      • 2.8
      • 2.7
      • 2.6
      • 2.5
      • 2.4
      • 2.3
      • 2.2
      • 2.1
      • 2.0
      • 1.3
      • 1.2

Packages

  • Cake
    • Cache
      • Engine
    • Configure
    • Console
      • Command
        • Task
    • Controller
      • Component
        • Acl
        • Auth
    • Core
    • Error
    • Event
    • I18n
    • Log
      • Engine
    • Model
      • Behavior
      • Datasource
        • Database
        • Session
      • Validator
    • Network
      • Email
      • Http
    • Routing
      • Filter
      • Route
    • TestSuite
      • Coverage
      • Fixture
      • Reporter
    • Utility
    • View
      • Helper

Classes

  • BaseLog
  • ConsoleLog
  • FileLog
  • SyslogLog

Class FileLog

File Storage stream for Logging. Writes logs to different files based on the type of log it is.

BaseLog implements CakeLogInterface
Extended by FileLog
Package: Cake\Log\Engine
Copyright: Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
License: MIT License
Location: Cake/Log/Engine/FileLog.php

Properties summary

  • $_defaults protected
    array
    Default configuration values
  • $_file protected
    string
    Log file name
  • $_path protected
    string
    Path to save log files on.
  • $_size protected
    integer
    Max file size, used for log file rotation.

Inherited Properties

  • _config

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 rotate count 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

  • types string or array, levels the engine is interested in
  • scopes string or array, scopes the engine is interested in
  • file Log file name
  • path The path to save logs on.
  • size Used 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.
  • rotate Log files are rotated specified times before being removed. If value is 0, old versions are removed rather then rotated.
  • mask A 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
BaseLog::__construct()

_getFilename() protected ¶

_getFilename( string $type )

Get filename

Parameters
string $type
The type of log.
Returns
string
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. Void if file doesn't need to be rotated.


config() public ¶

config( array $config = array() )

Sets protected properties based on config provided

Parameters
array $config optional array()
Engine configuration
Returns
array
Overrides
BaseLog::config()

write() public ¶

write( string $type , string $message )

Implements writing to log files.

Parameters
string $type
The type of log you are making.
string $message
The message you want to log.
Returns
boolean
success of write.

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,
)

$_file ¶

protected string

Log file name

null

$_path ¶

protected string

Path to save log files on.

null

$_size ¶

protected integer

Max file size, used for log file rotation.

null
OpenHub
Rackspace
Rackspace
  • Business Solutions
  • Showcase
  • Documentation
  • Book
  • API
  • Videos
  • Reporting Security Issues
  • Privacy Policy
  • Logos & Trademarks
  • Community
  • Get Involved
  • Issues (GitHub)
  • Bakery
  • Featured Resources
  • Training
  • Meetups
  • My CakePHP
  • CakeFest
  • Newsletter
  • Linkedin
  • YouTube
  • Facebook
  • Twitter
  • Mastodon
  • Help & Support
  • Forum
  • Stack Overflow
  • Slack
  • Paid Support

Generated using CakePHP API Docs