I've been working on a bug where an application is logging out unexpectedly.
To identify the piece of code that is destroying the session namespace I've been using the code snippet:
What it does is dumps out the stack that called the function it is placed in.
You can add additional information like a timestamp or FILE_APPEND.
You may also want to use Zend's logging. The reason I don't use it is that every instruction adds overhead. Once this issue is resolved, I'll remove all the debug code. I hope.
Credit to the link. :)