Page 1 of 1

TIP: Debug statements to log files.

Posted: Wed May 22, 2013 9:11 pm
by calguy1000
Did you know as a CMSMS developer there are some useful debugging tools to allow outputting debug statements or complex data types to a log file?

debug_to_log()
outputs the string, or data provided to the tmp/cache/debug.log file. It accepts 2 arguments, the first being the data to output. The second being an optional header string.
i.e:
$tmp = array('foo'=>1,'bar'=>2);
debug_to_log($tmp,'TESTING');

debug_bt_to_log()
outputs the current backtrace to the tmp/cache/debug.log file.

Note:
In order for this functionality to operate the config option 'debug_to_log' must be enabled in the config.php file.
i.e: $config['debug_to_log'] = 1;