Skip to content

Instantly share code, notes, and snippets.

@snowwolf007cn
Last active August 29, 2015 13:57
Show Gist options
  • Save snowwolf007cn/9852702 to your computer and use it in GitHub Desktop.
Save snowwolf007cn/9852702 to your computer and use it in GitHub Desktop.
Below is my configration in global.php
return array(
'service_manager' => array(
'abstract_factories' => array(
'Zend\Log\LoggerAbstractServiceFactory'
)
),
'log' => array(
'Application\Web' => array(
'writers' => array(
array(
'name' => 'stream',
'priority' => 5,
'options' => array(
'stream' => 'log/app.log'
)
)
)
)
)
);
I tried to set priority from 1-1000, it'll still output message to log file in all level.
What am I doing wrong? testing code below:
class IndexController extends AbstractActionController
{
public function indexAction()
{
try {
$logger = $this->getServiceLocator()->get('Application\\Web');
$logger->emerg('test');
$logger->info('aaa');
} catch (\Exception $e) {
do {
var_dump($e);
} while ($e = $e->getPrevious());
}
return new ViewModel();
}
}
if I set the 'priority' => 1
in app.log:
2014-03-29T19:31:54+08:00 EMERG (0): test
2014-03-29T19:31:54+08:00 INFO (6): aaa
if I set the 'priority' => 7
in app.log:
2014-03-29T19:32:57+08:00 EMERG (0): test
2014-03-29T19:32:57+08:00 INFO (6): aaa
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment