[pmwiki-users] debugging using error_log stuff

Tamara Temple tamouse.lists at gmail.com
Sun Jun 12 14:18:54 CDT 2011

I read the recipe on debugging pmwiki functions and such at
	< http://www.pmwiki.org/wiki/Cookbook/DebuggingForCookbookAuthors >

This isn't a PmWiki problem, per se, which is why it's going to both  

I inserted the little sms function into pmwiki.php itself to try out  
(PmWiki developers: is there a better place to do this?)

It's working, but I modified it slightly to log sms's:

function sms($text,$switch=0){
	global $MessagesFmt;
	error_log(date(DATE_RFC822)." Entered sms. text=$text. switch=$switch 
	if ($switch == true || is_array($text)) {
		$MessagesFmt[] = "<pre>" . print_r($text,true) . "</pre>\n";
	} else {
		$MessagesFmt[] = $text . "<br />\n";
	error_log(date(DATE_RFC822)." Exit sms.\n");

So that i could watch it execute by tailing the error log.

I put the following line at the very top of pmwiki.php:

error_log(date(DATE_RFC822)." pmwiki start\n",3,"/var/log/pmwiki/ 

Then, down below, after where $MessagesFmt is zeroed out, I put:

sms("Test Debugging");

However, all I see in the error log is the startup message, the entry  
message, BUT no exit message appears:

Sun, 12 Jun 11 14:10:27 -0500 pmwiki start
Sun, 12 Jun 11 14:10:27 -0500 Entered sms. text=Test Debugging. switch=0

The sms message shows up in the (:messages:) markup as expected.

Any ideas what I'm doing wrong? This is stumping me.

More information about the pmwiki-users mailing list