As I’m helping a dev figuring out a broken wp theme, I came over this, imho, super-tip on howto print contents of a variable to the httpd log file.
In this particular case I’ve narrowed it down to a variable that seem to behave different between a 2 minor wordpress versions.
file_put_contents('php://stderr', print_r($foo, TRUE))
Will print the content of variable $foo to the httpd log, in my case I put that into places in the code to track content for a couple variables in the code, I added a ‘mark’ as well to easily grep it from the weblog
file_put_contents('php://stderr', print_r('Here man: $foo', TRUE));
I found this over at stackoverflow.com