k1low / yalog
Yalog: CakePHP 的另一个日志记录器
2.5.5
2014-10-23 01:46 UTC
Requires
- aws/aws-sdk-php: *
- composer/installers: *
- fluent/logger: v0.3.6
Requires (Dev)
- phpunit/phpunit: 3.7.*
README
RotateFileLog
使用方法
首先,将 `Yalog' 目录放在您的 CakePHP 应用程序的 app/Plugin 中。
其次,在 bootstrap.php 中添加以下代码。
<?php
CakePlugin::load('Yalog');
// or
// CakePlugin::loadAll();
App::uses('CakeLog', 'Log');
CakeLog::config('debug', array(
'engine' => 'Yalog.RotateFileLog',
'types' => array('notice', 'info', 'debug'),
'file' => 'debug',
));
CakeLog::config('error', array(
'engine' => 'Yalog.RotateFileLog',
'types' => array('warning', 'error', 'critical', 'alert', 'emergency'),
'file' => 'error',
));
配置
轮转
<?php
Configure::write('Yalog.RotateFileLog.weekly', true);
Configure::write('Yalog.RotateFileLog.rotate', 4);
Log4php (示例)
使用方法
首先,将 `Yalog' 目录放在您的 CakePHP 应用程序的 app/Plugin 中。
其次,将 log4php 源目录放在您的 CakePHP 应用程序的 app/Plugin/Yalog/Vendor/log4php 中。
https://logging.apache.ac.cn/log4php/download.html
第三,在 bootstrap.php 中添加以下代码。
<?php
CakeLog::config('debug', array(
'engine' => 'Yalog.Log4php',
'types' => array('notice', 'info', 'debug'),
'file' => 'debug',
));
CakeLog::config('error', array(
'engine' => 'Yalog.Log4php',
'types' => array('warning', 'error', 'critical', 'alert', 'emergency'),
'file' => 'error',
));
配置
修改以下内容:
- app/Plugin/Yalog/Lib/Log/Engine/log4php.properties
- app/Plugin/Yalog/Lib/Log/Engine/log4php.php 中的 Log4php::write()
许可证
MIT 许可证