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.9 API

  • Overview
  • Tree
  • Deprecated
  • Version:
    • 2.9
      • 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
  • None

Classes

  • BaseLog
  • ConsoleLog
  • FileLog
  • SyslogLog

Class SyslogLog

Syslog stream for Logging. Writes logs to the system logger

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

Properties summary

  • $_defaults protected
    array

    By default messages are formatted as: type: message

  • $_open protected
    boolean
    Whether the logger connection is open or not
  • $_priorityMap protected
    array
    Used to map the string names back to their LOG_* constants

Inherited Properties

  • _config

Method Summary

  • __construct() public

    Make sure the configuration contains the format parameter, by default it uses the error number and the type as a prefix to the message

  • __destruct() public
    Closes the logger connection
  • _open() protected

    Extracts the call to openlog() in order to run unit tests on it. This function will initialize the connection to the system logger

  • _write() protected

    Extracts the call to syslog() in order to run unit tests on it. This function will perform the actual write in the system logger

  • write() public
    Writes a message to syslog

Method Detail

__construct() public ¶

__construct( array $config = array() )

Make sure the configuration contains the format parameter, by default it uses the error number and the type as a prefix to the message

Parameters
array $config optional array()
Options list.
Overrides
BaseLog::__construct()

__destruct() public ¶

__destruct( )

Closes the logger connection

_open() protected ¶

_open( string $ident , integer $options , integer $facility )

Extracts the call to openlog() in order to run unit tests on it. This function will initialize the connection to the system logger

Parameters
string $ident
the prefix to add to all messages logged
integer $options
the options flags to be used for logged messages
integer $facility
the stream or facility to log to

_write() protected ¶

_write( integer $priority , string $message )

Extracts the call to syslog() in order to run unit tests on it. This function will perform the actual write in the system logger

Parameters
integer $priority
Message priority.
string $message
Message to log.
Returns
boolean

write() public ¶

write( string $type , string $message )

Writes a message to syslog

Map the $type back to a LOG_ constant value, split multi-line messages into multiple log messages, pass all messages through the format defined in the configuration

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

Methods inherited from BaseLog

config() public ¶

config( array $config = array() )

Sets instance config. When $config is null, returns config array

Config

  • types string or array, levels the engine is interested in
  • scopes string or array, scopes the engine is interested in
Parameters
array $config optional array()
engine configuration
Returns
array

Properties detail

$_defaults ¶

protected array

By default messages are formatted as: type: message

To override the log format (e.g. to add your own info) define the format key when configuring this logger

If you wish to include a prefix to all messages, for instance to identify the application or the web server, then use the prefix option. Please keep in mind the prefix is shared by all streams using syslog, as it is dependent of the running process. For a local prefix, to be used only by one stream, you can use the format key.

Example:

CakeLog::config('error', array(
    'engine' => 'Syslog',
    'types' => array('emergency', 'alert', 'critical', 'error'),
    'format' => "%s: My-App - %s",
    'prefix' => 'Web Server 01'
));
array(
    'format' => '%s: %s',
    'flag' => LOG_ODELAY,
    'prefix' => '',
    'facility' => LOG_USER
)

$_open ¶

protected boolean

Whether the logger connection is open or not

false

$_priorityMap ¶

protected array

Used to map the string names back to their LOG_* constants

array(
    'emergency' => LOG_EMERG,
    'alert' => LOG_ALERT,
    'critical' => LOG_CRIT,
    'error' => LOG_ERR,
    'warning' => LOG_WARNING,
    'notice' => LOG_NOTICE,
    'info' => LOG_INFO,
    'debug' => LOG_DEBUG
)
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