TIP: Debug statements to log files.

Talk about writing modules and plugins for CMS Made Simple, or about specific core functionality. This board is for PHP programmers that are contributing to CMSMS not for site developers
Post Reply
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm
Location: Fernie British Columbia, Canada

TIP: Debug statements to log files.

Post 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;
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
Post Reply

Return to “Developers Discussion”