Create Zend Server Monitor Event #2343

wants to merge 1 commit into


None yet

3 participants


Create Zend Server Monitor Event when exception thrown


I don't "understand" the strategy here 😉

It's a bad idea IMHO:

  1. All people don't run with a Zend Server as PHP stack (apache, nginx, ...)
  2. We have already Zend\Log\Writer\ZendMonitor, so you catch the exception and log the event with the needed backend. Where is the benefit here?

I would dismiss this PR.

@weierophinney weierophinney commented on the diff Sep 13, 2012
+ $events->attach($zendMonitorExceptionStrategy);
weierophinney Sep 13, 2012

This is the wrong place to wire it. Since it has to do with dispatch logic, it should not be in the ViewManager.

I'd recommend creating a Logger service factory. Users could then call on that to attach additional writers, or to simply get the logger instance. We could then by default add a ZendMonitor log writer, and have filters attached to it that only log in certain situations. This could then be attached to specific events.

b-durand Sep 14, 2012

Why add a ZendMonitor LogWriter by default? I don't understand...

@weierophinney weierophinney commented on the diff Sep 13, 2012
@@ -0,0 +1,118 @@
+ * Zend Framework (
+ *
+ * @link for the canonical source repository
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (
+ * @license New BSD License
+ * @package Zend_Mvc
+ */
+namespace Zend\Mvc\View\Http;
weierophinney Sep 13, 2012

Again, this is not view related. I'd actually put it at the top-level of the Mvc hierarchy instead.

@weierophinney weierophinney commented on the diff Sep 13, 2012
+ }
+ switch ($error) {
+ case Application::ERROR_ROUTER_NO_MATCH:
+ // Specifically not handling these
+ return;
+ case Application::ERROR_EXCEPTION:
+ default:
+ if (!empty($e)) {
+ $exception = $e->getParam('exception'); /* @var $exception \Exception */
+ $message = 'An error occurred during execution: ' . $exception->getMessage();
+ if ($this->isCustomEventByRuleIsEnabled()) {
+ zend_monitor_custom_event_ex('Zend Framework Exception', $message, 'Zend Framework Exception Rule');
weierophinney Sep 13, 2012

Why isn't the ZendMonitor log writer being used here?

Zend Framework member

Ruslan -- we may want to chat a bit about this over email or skype. I think a different direction is likely necessary, and want to go over ideas with you.


We don't have a "global" exception handler (aka try/catch) in MVC dispatch or you want to use Error in event without exception?

@weierophinney weierophinney reopened this Sep 14, 2012
Zend Framework member

Closing, following a discussion with Yonni Mendes (from the Server UI team); he will likely submit a new PR based on the feedback I gave to him verbally.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment