Hi,
Have you taken a look at Xdebug - http://xdebug.org/ ?
From the manual: "Xdebug allows you to log all function calls, including
parameters and return values to a file in different formats."
Would this do what you need - then your second script could process this file?
Regards,
Andy
On 25 Dec 2009, at 04:42, Rene Veerman wrote:
> Hi,
>
> I would like the opinion of the readers of this list on whether or not they
> agree on the usefullness of adding some new functions to the core of PHP.
>
> Background Info:
>
> I want more debug-information from my scripts.
> And I want to perform lengthy operations in a more robust way.
> And I want to monitor such operations in real-time, with points of interest
> highlighted, from a webbrowser, using jquery ajax calls.
> For instance, when 1000 items are being processed and 10 fail, i want those
> listed (with full details) instead of them cancelling the rest of the
> operation.
>
> For each lengthy operation, i want to keep track of:
> - $operationName, $contextName
> - a full trace, with per function the (timing-)stats, arguments, errors
> (possibly including notices), and results.
> - the ability to monitor the operation flow from a webbrowser (using ajax
> calls) in realtime.
> - the ability to store such logs (filtered or not) in a database via
> adodb.sf.net, or in a file (json / plaintext), or to email them.
>
> I'm considering to release the library i'm building for this as LGPL,
> including a viewer.
>
> Problem description:
>
> To enable a full trace i need to call a function that i create, on entry of
> any other function, and on exit of such a function.
> Obviously adding (even simple, standard) calls to every function i use is
> too cumbersome, and i'd miss all the php built-in functions.
>
> The simplest solution to this imo, is to add this to the core of PHP:
>
> $oldTraceHandlerFunctionName = set_trace_handler (
> $handlerFunctionName = 'traceHandler',
> $functionList = array (
> 'functionName',
> ....
> ) OR (default:)null=monitor all functions,
> );
>
> function traceHandler (
> $file = string;fullpath,
> $lineNumber = integer,
> $functionName = string,
> $eventIsStartOfFunction=boolean, // false = being called at exit of
> the function
> $arguments = array(
> '[&]$argumentVariableName' => anyVariable,
> ....
> ),
> $localVariables = array(
> 'localVariableName' => anyVariable,
> ....
> )
> ) {
> //do something
> }
>
> If you have any improvements for this mockup, please post them as reply.
>
>
> While there are the profiling functions of
> http://nl2.php.net/manual/en/function.apd-set-pprof-trace.php,
> I would nevertheless to propose adding of the new capabilities listed above
> here,
> for people who don't have enough control over their webserver to install the
> requirements of apd-set-pprof-trace.
>
> Also, i haven't looked into it yet, but converting the apd-set-pprof-trace
> data to any other format seems to be difficult to do in realtime because it
> writes such data to disk.
> Turning such data into your own format in realtime will be prone to slowness
> &/ errors.
>
> I'll also look at using apd-set-pprof-trace, since none of this is likely to
> be implemented soon..
> I'll post updates to this thread if i solve that puzzle.