===== 1.3x で pear =====
* Pear::Log\\ http://pear.php.net/package/Log
* CakePHP 1.3系 でPearを使う\\ /app/config/bootstrap.php に
App::build(array('pears' => array('/usr/share/php')), true);
Pear を使用するところに
App::import('pear', 'TagCloud', array('file' => 'HTML/TagCloud.php'));
* ログを取る[Pear::Log]\\ http://www.bnote.net/php/pear/log01.shtml
* PEAR::Log\\ http://blog.livedoor.jp/alpha1280/archives/50197776.html
* cakephpで個別にpearライブラリをインストールする方法\\ http://php-tips.com/php/cakephp-php/2010/03/cakephp%E3%81%A7%E5%80%8B%E5%88%A5%E3%81%ABpear%E3%83%A9%E3%82%A4%E3%83%96%E3%83%A9%E3%83%AA%E3%82%92%E5%88%A9%E7%94%A8%E3%81%99%E3%82%8B%E6%96%B9%E6%B3%95
bootstrap.php
App::build(array('pears' => array('/usr/share/pear')), true);
対象cntoroller その1
App::import('pear', 'Log', array('file' => 'Log.php'));
$log = Log::factory('file', '/var/www/vhosts/mlb/cake/api.mlb.jp/tmp/logs/log.txt', 'ident');
$log->log(serialize($this->params['form']), PEAR_LOG_INFO);
対象cntoroller その2
public function index() {
$this->customLog('custom.log', $this->params['form'], 'tag');
}
public function customLog($filename, $param, $ident) {
App::import('pear', 'Log', array('file' => 'Log.php'));
/*
$param = serialize($param);
$handler = 'file';
$name = LOGS . $filename;
$ident = $ident;
$conf = array('mode'=>0644,'timeFormat'=>'%Y/%m/%d %H:%M:%S');
$level = PEAR_LOG_INFO;
$log = Log::singleton($handler, $name, $ident, $conf, $level);
*/
$log = Log::singleton('file', LOGS . $filename, $ident,
array('timeFormat'=>'%Y/%m/%d %H:%M:%S'));
$log->log(serialize($param));
}