News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Rob Allen:
Simple logging of ZF2 exceptions
April 25, 2013 @ 10:31:40

In this new post to his site Rob Allen shows you how to implement a simple logging method for catching exceptions in your Zend Framework 2 application.

I recently had a problem with a ZF2 based website where users were reporting seeing the error page displayed, but I couldn't reproduce in testing. To find this problem I decided to log every exception to a file so I could then go back and work out what was happening. In a standard ZF2 application, the easiest way to do this is to add a listener to the 'dispatch.error' event and log using ZendLog.

He uses an event listener to attach a service that contains a "logException" method. This method uses the ZendLog component to write out the error message to a local log file including a backtrace of where the issue occurred.

0 comments voice your opinion now!
simple logging exception handling service event listener tutorial

Link: http://akrabat.com/zend-framework-2/simple-logging-of-zf2-exceptions

blog comments powered by Disqus

Similar Posts

PHPMaster.com: Localizing PHP Applications "The Right Way", Part 5

Fabien Potencier's Blog: Symfony Service Container

WeberDev.com: PHP 101 (part 11) - Sinfully Simple (SimpleXML)

Sudheer Satyanarayana's Blog: A Bit Of XML, RSS And CURL In 7 Lines Of PHP And A Useful Program

IBM developerWorks: PHP frameworks, Part 1: Getting started with three popular frameworks


Community Events





Don't see your event here?
Let us know!


opinion symfony install language podcast framework bugfix laravel series voicesoftheelephpant package tips list api community introduction deployment library interview release

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework