News Feed
Sections




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

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


blog comments powered by Disqus

Similar Posts

Mike Naberezny's Blog: Easier XML-RPC for PHP 5

PHPBuilder.com: Securing Data Sent Via GET Requests

Jani Hartikainen's Blog: Zend_Acl part 1: Misconceptions and simple ACLs

KodeInfo.com: Pay with Bitcoin using Coinbase and Bitpay

Sameer Borate's Blog: Detecting duplicate code in PHP files


Community Events

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


series install voicesoftheelephpant podcast framework example opinion version interview language xdebug release extension unittest api library introduction community php7 laravel

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