Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

logger class error 1

Status
Not open for further replies.

DaveC426913

Programmer
Jul 28, 2003
274
CA
I want to log the inner workings of my code. I downloaded this Logger file: which seems simple enough, but it doesn't work.

I suspect I'm hitting compatibiltiy issues, since this was originally built for PHP3.

Still , I can't see why it's choking on the code at that line.

I tried throwing away the boolean values and using 0/1 strings but that wasn't the problem.


Parse error: unexpected '(', expecting ',' or ';' in class.Logger.php3 on line 31


Code:
25 Class Logger
26 {
27  
28  	var $FILELIST	=	array();
29  	var $ROOT		=	"";
30  	var $WIN32		=	false;
31  	var $PID		=	getmypid();
	var $FORMAT		=	"%b %d %H:%M:%S";
	var $DEBUG		=	true;
 
Except for oooooone little thing...

When I go to another page, it stops updating the log from the new page. (I'm betting dollars to donuts that the reason is because the new page will find the file locked for writing.)

So, either I need to make the handle of the open file globally available, or I need to close it when I leave the page and re-open it on the next page. Is it simply a matter closing the file in the page unload?


This is how I'm implemetning it on each of my pages:


define ('LOGFILE', 'func_trace.log');
function logthis($Text)
{
error_log ($Text . "\n", 3, LOGFILE);
}

...
logthis("index: displayList ()");
 
Path problem? No, they're all in the same directory, (though they do call functions in some classes from an inc/ subdirectory.)

Besides, even if they weren't, I'd just see log files in each directory wouldn't I?

To experiment, I have given each page a unique log file to write to, and now I have one log file for each page, all in the same dir. That rules out a path problem.

 
< span style="text-size: .001pt" >
It was working fine. The log file I'd downloaded was stale.
< /span >
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top