-- sgrobins <[EMAIL PROTECTED]> wrote
(on Wednesday, 30 July 2008, 11:37 AM -0700):
> I am using Zend_Log for all my output in a script that is run from cron.
> Everything works great. I have it writing to a log file each night.
>
> The problem is if the script encounters a Fatal Error or a PHP Warning,
> those are not put into the log file, since that output didn't go through
> Zend_Log. Is there a way to redirect the STDERR to my Zend_Log object, so
> it becomes something like this:
>
> $logger->err( "whatever php error produced" );
>
> Then each day I can look at my log file and see exactly where these php
> warnings or errors are happening in my script.
You can register an error handler, and have it write to your logger; see
http://us3.php.net/set_error_handler
for details. In such a case, I'd ensure the logger is in your registry
so you can pull it out in your callback.
That said, parse, compile, and fatal errors will never trigger the error
handler, and you may want to filter warnings (as an fopen() call in
Zend_Loader creates warnings that can safely be ignored).
--
Matthew Weier O'Phinney
Software Architect | [EMAIL PROTECTED]
Zend Framework | http://framework.zend.com/