The questions says everything. I am logging something on STDOUT.Should I use echo for displaying or Die()
.As far as I know If I use die() for normal printing like die('Entered in For loop')
, it exits the program.
Also is it good to log to files or mysql?
use echo or Die for debugging and logging
919 Views Asked by AudioBubble At
2
For debugging I prefer
var_dump()
. If you install Xdebug (http://xdebug.org/) in your development environment, you'll get a lot more out of var_dump.When I want to kill a script I'm debugging, I wrap die around that, as in
die(var_dump())
.For logging, look into PHP's
error_log()
(http://www.php.net/manual/en/function.error-log.php) function or a logging library such as monolog (https://github.com/Seldaek/monolog).