Front End Logging (tail -f stuff)
Entering a new coding environment (working in a national company), I’ve got several things learned.
One of the important is that I have to take care of every logging activities. It means that people needs me to write any transaction (success, fail, or error) to a flat file.
After my application’s been launching live, the “operation people” can check the log file for any transaction activities using unix command :
tail -f <log_file>
Rather than supply them with backend checking, I’d prefer to make it (checking log file) into frontend using php.
Here’s the code I scratch to “tail” the log file in FrontEnd :
setInterval ( "window.scrollBy(0,100)", 5 );
$page = $_GET[log]; //supply this GET variable with path to log file
system("tail -f $page");
echo "<h1>Please provide log file to read !</h1>";
With this code, I can simulate tail activities in web browser