News Feed
Sections




News Archive
feed this:

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

Slawek Lukasiewicz's Blog:
Zend Framework logging with Firebug and FirePHP
May 24, 2011 @ 09:44:46

Slawek Lukasiewicz has a new post to his blog today showing you how to use the popular Firebug extension for Firefox with the FirePHP plugin to make error logging simpler and less obtrusive without ever having to leave the browser.

If you use Firefox, I bet you already know Firebug extension. This is irreplaceable tool for web development. But there is also FirePHP extension, which provides possibility to log into Firebug console from PHP scripts. This is very convenient way for debugging process, because logs are independent from application output.

He shows the integration you can do with the Zend Framework's Zend_Log component to write basic messages and the Zend_Wildfire component to write tabular data back to your browser's console with two snippets of code.

0 comments voice your opinion now!
logging firebug firephp tutorial zendframework zendlog zendwildfire


Josh Adell's Blog:
Logging User Sessions Across Requests
May 20, 2011 @ 09:10:06

Josh Adell has a new post to the Everyman Software blog talking about a solution he and his team have developed for logging user sessions across requests with the help of the Zend_Log component and a custom logging formatter.

One way to handle this is to put a request-specific identifier in every log message. But I shouldn't have to remember to append or prepend the identifier to their log messages. I'd rather have it happen automatically, without me or my teammates having to think about it. Here's a method we've been using to try and untangle the mess and retain the usefulness of our logs. The code uses Zend's logging component, but can easily be adapted to other log systems.

Their example sets a custom log format message with placeholders for a timestamp, log ID number and the log message. A unique ID is then generated for the user's session and applied to the Zend_Log object. This data is then automatically applied to the log file's output without any extra hassle. The full sample code (pretty simple, really) is included.

0 comments voice your opinion now!
log user session zendlog zendframework tutorial


Ole Markus' Blog:
Catching fatal errors in PHP
March 11, 2011 @ 09:16:42

Ole Markus has a new post today looking at how you can catch fatal errors in your PHP applications a bit more gracefully than the usual failure messages.

In dynamic languages like PHP [errors like E_ERROR and E_PARSE] happen all the time, for example when trying to call a method on a variable you assumed was an instance of a specific class, but which for some reason suddenly was not instantiated. Not only are they often not catched, but often it is also difficult to even know that they are occurring.

His solution comes in the form of a built-in PHP function, register_shutdown_function, that executes when the PHP process is shutting down - errors or not. It takes in a callback method that has access to an exception object. You can get lots of interesting information from this object and, as in his example, log it to a file for future investigation.

0 comments voice your opinion now!
catch fatal error registershutdownfunction exception zendlog


Kevin Shroeder's Blog:
Zend_Log with multiple writers
September 14, 2010 @ 10:39:34

Kevin Schroeder has a recent post to his blog about a handy trick Zend Framework developers can use to have Zend_Log write out to multiple sources at once pretty easily.

If you were not aware, Zend_Log provides facilities for writing to multiple logs through the same log instance. Additionally, you can do this via configuration options when using a Zend_Application resource plugin. Together those make for very powerful logging mechanisms. "How?" you ask? It's really easy.

The trick lies in the application.ini file configuration. He includes an example of how you can set this up showing how to make two different environments log differently - development writes to log/firebug and production just writes to the log. He includes some sample code for a basic controller showing you how to use it.

0 comments voice your opinion now!
zendlog zendframework tutorial multiple write development production


Zend Developer Zone:
Zend_Log timestamp filter
July 19, 2010 @ 12:24:48

On the Zend Developer Zone there's a recent post about a custom filter that's been developed to help filter events based on time instead of just logging them as a whole.

For one of my recent project, which is using Zend_Log component of the Zend Framework, I had a demand in which I needed to be able to filter log events based on the time they occurred. As out of the box, Zend_Log component does not have such filter, I decided to create one that will fulfill my demands.

The log filter, NP_Log_Filter_Timestamp, it allows you to set rules for things like hour, minute year, day of the week, etc. and can be used anywhere you'd create a normal Zend_Log instance. Pass it in the format you'd like to use (that idate can use), a value to evaluate and a comparison operator. Two code snippets show how it's used.

0 comments voice your opinion now!
zendframework zendlog custom filter timestamp


ZendCasts.com:
Transparent Logging with Zend_Log
June 17, 2010 @ 08:35:42

New on the ZendCasts.com site, there's a screencast about using Zend_Log to create a full logging framework for your Zend Framework-based application.

I was working on a project for a client the other day and noticed a couple of lines in the ErrorController for automatically logging errors with Zend_Log. In 10 minutes, you can have a fully integrated logging framework. I also implement a singleton pattern for reusing your Zend_Log configuration (defined in the application.ini) anywhere else in your application.

You can watch the screencast via the in-page player and follow along with the code if you'd like to download it from here.

0 comments voice your opinion now!
screencast tutorial zendframework zendlog logging


ZendCasts.com:
Reporting with Zend_Tool and Zend_Log
April 28, 2010 @ 08:43:23

On the ZendCasts.com site there's a new screencast continuing their look at the Zend_Tool component by combining it with Zend_Log to do some easy reporting.

This video uses a collection of powerful PHP libraries in order to illustrate how easy it really is to build a command-line tool for reporting against XML files. We start off by logging visitor statistics in the controller into a log file with Zend_Log. Once data has been collected, we're then able to utilize SimpleXML, Zend_Date and the Zend_Tool component to build out a very simple reporting tool.

He suggests one possible use is to create a cron job that will regenerate the reports nightly. You can view the screencast in the post or download a copy of the project to get started right away.

0 comments voice your opinion now!
zendtool zendlog zendframework webcast tutorail reporting


Pablo Viquez's Blog:
Zend_Log, FirePHP and Zend_Application. How to
November 30, 2009 @ 10:33:25

Pablo Viquez has written up a mini-tutorial on getting your Zend Framework application's errors to log out to the Firebug panel (from the extension) with the help of FirePHP and Zend_Log.

I wanted to enable logging of exceptions to my PHP log file and also display them using FireBug. On a standard setup of Zend Framework, the Zend error handler plugin (Zend_Controller_Plugin_ErrorHandler) enable by default [...] I wanted to keep using the error handler plugin and didn't want to log the exceptions by using: Zend_Controller_Front::throwExceptions() or Zend_Controller_Response_Abstract::renderExceptions() or any other way since eventually might get complicated, besides, I think that the error handler plugin works fine and if it gets updated in the future, I won't have to do a major refactor.

He shows how to create the Zend_Log object to write out on the development system (based on the ini setting for the Zend Framework application), how to use it to send the log message out to the waiting client. Examples of the output - a screenshot of the Firebug panel and the error log output.

0 comments voice your opinion now!
firephp zendapplication zendlog tutorial


Raphael Stolt's Blog:
Logging to MongoDb and accessing log collections with Zend_Tool
September 22, 2009 @ 09:49:47

Raphael Stolt has written up a new tutorial looking at connecting the MongoDb document-oriented database with the Zend_Log component of the Zend Framework to push log entries into the database.

I tinkered with the just recently discovered MongoDb and hooked it into the Zend_Log environment by creating a dedicated Zend_Log_Writer. The following post will therefore present a peek at a prototypesque implementation of this writer and show how the afterwards accumulated log entries can be accessed and filtered with a custom Zend_Tool project provider.

He extends the Zend_Log_Writer class to create the interface for the MongoDb and uses the mongo interface for PHP to bridge the gap. The application's INI file and Bootstrap are then modified to add in this new functionality and some example usage code is created both with and without the Zend_Tool tool.

0 comments voice your opinion now!
zendtool mongodb zendlog tutorial


phpRiot:
Zend Framework 101 Zend_Log
April 13, 2009 @ 08:46:13

Next up in the phpRiot "Zend Framework 101" series is this new look at the logging component of the Zend Framework - Zend_Log.

This article shows you how to use Zend_Log, the logging component of the Zend Framework. It allows you to record messages from your application however you please. In this article I will show you how to record messages to a log file. Additionally, if you use the Firebug and FirePHP plug-ins for Firefox, Zend_Log can be extremely useful for application development and debugging. I will also show you how to achieve this.

They walk you through the creation of a simple logger and putting it to use by recording just the events you want (via error levels). There's also an extra section on integrating it with the Firebug/FirePHP extensions for Firefox and push your messages directly to the browser.

0 comments voice your opinion now!
zendframework zendlog tutorial introduction logger firebug firephp writer



Community Events





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


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

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