App::build(array('pears' => array('/usr/share/php')), true);
Pear を使用するところに
App::import('pear', 'TagCloud', array('file' => 'HTML/TagCloud.php'));
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)); }