Closed samsonasik closed 9 years ago
I'm trying to re-set formatters of the Logger but it seems it not changed on loop formatters, and when changin on loop by addWriter, it got hang. @acelaya do you have an idea to re-set writers's formatter/filter so it can switch? hint : SplPriorityQueue...
I've been taking a look at a project where I used a logger.
Have you tried by setting the priority
as a config property at the same level of options
and name
? The Logger constructor seems to look there for it.
Instead of this
'writers' => [
[
'name' => 'stream',
'options' => [
'stream' => 'php://output',
'filters' => [
'priority' => [
'name' => 'priority',
'options' => [
'priority' => \Zend\Log\Logger::DEBUG,
],
],
],
'formatter' => [
'name' => 'simple',
'options' => [
'format' => '%timestamp% %priorityName% (%priority%): %message%'.PHP_EOL,
],
],
],
],
],
Try with this
'writers' => [
[
'name' => 'stream',
'priority' => \Zend\Log\Logger::DEBUG,
'options' => [
'stream' => 'php://output',
'formatter' => [
'name' => 'simple',
'options' => [
'format' => '%timestamp% %priorityName% (%priority%): %message%'.PHP_EOL,
],
],
],
],
],
Ok, I will try if that possible be change-able on form posted change priority/formatter. Thank you.
I'm thinking about not inject controller with Logger instance, but use 'log' config as controller property, and create new Logger on the fly when form submitted, so Logger instance can be created by :
$this->loggerConfig['writers'][0]['options']['formatter']['name'] = $data['logformat'];
$logger = new Logger($this->loggerConfig);
I will do it..
it succeed, log generated : I will write test for it ;)
it's done, ready for review ;)
@acelaya any review for this ? merge-able ?
Sorry, I won't be able to test it until tomorrow evening, sorry. However I'm sure it works fine ;)
Alejandro Celaya Alastrué www.alejandrocelaya.com El 23/2/2015 11:21, "Abdul Malik Ikhsan" notifications@github.com escribió:
@acelaya https://github.com/acelaya any review for this ? merge-able ?
— Reply to this email directly or view it on GitHub https://github.com/sitrunlab/LearnZF2/pull/113#issuecomment-75518391.
It's ok for tomorrow ;). to reproduce it, there is updated ./data/sql/learnzf2.sql for addition module. Thank you.
Warm Regards,
Abdul Malik Ikhsan
2015-02-23 17:23 GMT+07:00 Alejandro Celaya notifications@github.com:
Sorry, I won't be able to test it until tomorrow evening, sorry. However I'm sure it works fine ;)
Alejandro Celaya Alastrué www.alejandrocelaya.com El 23/2/2015 11:21, "Abdul Malik Ikhsan" notifications@github.com escribió:
@acelaya https://github.com/acelaya any review for this ? merge-able ?
— Reply to this email directly or view it on GitHub https://github.com/sitrunlab/LearnZF2/pull/113#issuecomment-75518391.
— Reply to this email directly or view it on GitHub https://github.com/sitrunlab/LearnZF2/pull/113#issuecomment-75518576.
It properly works. It can be merged!
@acelaya merged. Thanks ;)
Fixes #106