Closed teseo closed 10 years ago
Thanks about the config/settings bug. This is now fixed.
As for the alias... it works perfectly on my system. When it comes to configs, they are merged together before they are processed, so the alias in module config will be overwritten by the one in global config. Is it possible that your application is setting up the service manager twice?
I'm pretty new to Zend Framework and some deep basics I'm not clear yet. It might be possible. Do you know how can I trace if the service manager is setup twice?
Many thanks for your patience!
No worries. Do you have the zend developer tools installed?
Yes I do.
You can check the final config, although I just realized you can't cause it throws error.
Yes, Is only once. I really would like to trace this down as it might affect in the future if you say you have the right way to do it.
I'm a bit lost what other reason could be to have overwritten the global config with vendor's config?
You can maybe hook into service manager and have it reporting to you how many times it gets setup? It may also be something more obvious I/you are missing.
Ok, I will do it after what I'm debugging now. The module seems to not to log exceptions in console mode.
Ok, got it. In Module.php line 74. When you have this closure
$sharedEventManager->attach('Zend\Mvc\Application', array(MvcEvent::EVENT_DISPATCH_ERROR, MvcEvent::EVENT_RENDER_ERROR), function($event) use ($logger, $generator) {}
On a web environment it gets the exception but not in console mode. I'm going to trace where we can fix this and propose a workaround / fix.
I've been working a little while and I figured out that when in console you throw an exception is not attaching to the event manager. Is not only it's not any of MvcEvent::EVENT_DISPATCH_ERROR, MvcEvent::EVENT_RENDER_ERROR even in if you set '*' is not getting attached.
Any idea? I'm walking in circles.
Hey Javier, I will have a look all of the issues later tonight or tomorrow. Thanks for your input.
Brilliant David. No rush.
For the moment with a bit of deeper debugging, I'm good. It would be just nice having errors logged on console mode.
Cheers mate!
Fixed the configuration issue. It was a very silly problem. The configuration in module.config.php was fine. The problem was with my factory name. I had a collision with "dherrorlogging_zend_db_adapter" the repetition was not because it was coming from your config but from my factory name:
'aliases' => array(
'dherrorlogging_zend_db_adapter' => 'Zend\Db\Adapter\Adapter',
),
'factories' => array(
'dherrorlogging_zend_db_adapter' => function ($sm){
This solves my problem.
'aliases' => array(
'dherrorlogging_zend_db_adapter' => 'dherrorlogging_zend_db_adapter_factory',
),
'factories' => array(
'dherrorlogging_zend_db_adapter_factory' => function ($sm){
Hope this helps someone else.
:), no worries, it happens to best of us.
Hello David,
I believe you should just remove from vendor/davidhavl/dherrorlogging/config/module.config.php the whole array:
And only leaving it on dherrorlogging.global.php. Just after the upgrade I got the same error
My proposal is, same way you commented the log_writter part, whether leave it commented or just in the global.php config. I had to do this in the module.config.php :
And this in my global.php config:
By the way, in the global.php config you are calling the main config array $config and in the bottom you are doing a ternary to the $settings variable. Is that correct?