On Sun, Mar 23, 2008 at 6:08 PM, Greg Sims <greg@xxxxxxxxxxxxx> wrote: > Hey There, > > I looked at the ob_start manual and found a segment of code that can be used > to capture the output of a shell script and place it into a log file. One > of the entries indicates this should work for both STDOUT and STDERR > (29-Mar-2007). I wrote the following piece of code to test it out. > > function logger($buffer) > { > $handle = fopen('/var/log/test.log', 'a'); > fwrite($handle, $buffer); > fclose($handle); > } > > ob_start("logger"); > > This will capture the output buffer until the shell terminates when the > buffer is dumped to the test.log file. This is a simple mechanism and it > works really well to keep STDOUT from going to the console and logging it. > Unfortunately, STDERR continues to go to the console which is what I am > working to avoid. > > I would like to capture STDOUT and STDERR using this technique. I am working > to create a self contained script that does not rely on some external script > to capture the output. The actual application needs to perform some > post-processing of the output buffer at the end of the script. > > Any pointers in the correct direction would be helpful! Thanks, Greg > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > You could use set_error_handler() and make your own function to echo out the error. -- -Casey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php