Sean's 4/16 notes

From Earlham CS Department
Jump to navigation Jump to search

Suspicious: controller/main.php initializes $error = "". The comment says $error is used to store the last/current error message. This is the last line of the script, so who knows what's happening to it.

Very Suspcicious: util/log.php has $LOG_FILE = "../logs/posit_web.txt", but the only file in logs/ is log.txt. There is what appears to be a constant, LOG, in line 22. It's in config.php at line 23, and is initialized to true. This is also where they define where they're actually putting the log (logs/log.txt).

We got rid of the line in util/log.php that initializes $LOG_FILE because it's not used ANYWHERE; it's actually using "LOG_FILE" which was defined as "./logs/log.txt" in config.php.

util/log.php currently uses the following date format: "h-i-s, j-m-y". We changed it to "M d H:i:s" so it's significantly more readable. Note: this doesn't include year.

Is there a log-rotator? Also, should we start saving the log in a system-standard place?

What gets put in the log: In controller/web.php, ANYTHING that calls the function webController logs the path and request passed to the webController function.

We deleted the commented-out statement that just wrote "Requested server" to the log every time webController was called. Also deleted it from controller/api.php.

A lot of errors, at least in api.php, are getting grabbed with "jsonError" or some similar thing. So they're pobably being logged somewhere - but where?