我正在尝试使用PhalconPHP来进行调试。Phalcon记录器/文件适配器不能正常工作
但不管我用什么代码,它加载浏览器的时候给了我这个错误:
Can't open log file at 'app/logs/test.log'
#0 /home/myuser/public_html/demo1/app/controllers/UsersController.php(6): Phalcon\Logger\Adapter\File->__construct('app/logs/test.l...')
#1 [internal function]: unknown()
#2 [internal function]: Phalcon\Loader->autoLoad('UsersController')
#3 [internal function]: spl_autoload_call('UsersController')
#4 [internal function]: Phalcon\Dispatcher->_dispatch()
#5 [internal function]: Phalcon\Dispatcher->dispatch()
#6 /home/myuser/public_html/demo1/public/index.php(42): Phalcon\Mvc\Application->handle()
#7 {main}
<?php
use Phalcon\Logger\Adapter\File as FileAdapter;
// Create the file logger in 'w' mode
$logger = new FileAdapter("app/logs/test.log", array(
'mode' => 'w'
));
供参考:所有的记录代码在一个尔康控制器测试。
$logger = new \Phalcon\Logger\Adapter\File("app/logs/test.log");
$logger->log("This is a message");
$logger->log(\Phalcon\Logger::ERROR, "This is an error");
$logger->error("This is another error");
$logger->close();
use Phalcon\Logger;
use Phalcon\Logger\Adapter\File as FileAdapter;
$logger = new FileAdapter("app/logs/test.log");
$logger->log(
"This is a message"
);