PHP code example of cakephp / monolog
1. Go to this page and download the library: Download cakephp/monolog library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
cakephp / monolog example snippets
CakePlugin::load('Monolog');
CakeLog::config('debug', array(
'engine' => 'Monolog.Monolog',
'channel' => 'app',
'handlers' => array(
'Stream' => array(
LOGS . 'debug.log',
'formatters' => array(
'Line' => array("%datetime% %channel% %level_name%: %message%\n")
)
)
)
));
CakeLog::config('logstash', array(
'engine' => 'Monolog.Monolog',
'channel' => 'app',
'handlers' => array(
'RotatingFile' => array(
LOGS . 'logstash.log',
30,
'formatters' => array(
'Logstash' => array('web', env('SERVER_ADDR'))
),
'processors' => array('MemoryPeakUsage')
),
'Stream' => array(
LOGS . 'logstash.log',
'formatters' => array(
'Line' => array("%datetime% %channel% %level_name%: %message% %context% %extra%\n")
),
'processors' => array('MemoryUsage', 'Web')
),
'CakeEmail' => array(
'[email protected] ',
'ALERT: APPLICATION REQUIRES IMMEDIATE ATTENTION.',
'default'
)
)
));