587Chapter 32Debuggingand get 10 lines of Common Log (Database web hosting)

587Chapter 32Debuggingand get 10 lines of Common Log Format output (assuming 10 loggable events have takenplace). More usefully, though, you can use tailin its follow (–follow) mode. In follow mode, tailreturns the 10 newest lines of a specified file, then goes into an infinite loop in which it watchesfor changes in the file and displays them when they happen. It s a simple way to monitor logfiles, and lots of administrators dedicate several terminals to the purpose of running tail–fsessions on various log files. The syntax is simple: tail –follow=name –retry error.logThat results in a constantly updated display of the contents of error.log. By specifying –follow=nameand –retry, the command guarantees that tail watches the file itself, notthe file descriptor. IISThe Microsoft HTTP server handles logging differently. Rather than log to a file, IIS records its status and error-reporting information so that it is available for examination in the EventViewer, which is one of the Administrative Tools on a Windows 2000 or XP system. You ll find IIS errors in the System Log portion of the Event Viewer window, with a sourcename of W3SVC. Microsoft offers advice on troubleshooting IIS errors at http://msdn.microsoft.com/library/ default.asp?url=/library/en-us/iisref/htm/TroubleshootingCommonIISErrors.asp. PHP Error Reporting and LoggingPHP can itself be a tremendous help in spotting errors. Straight out of the box, PHP will reporterror messages with output right into the browser window, complete with line numbers. This is as far as most people get with PHP s debugging aids, but it s important to know aboutthe details of configuring error reporting behavior in order to get the most out of it. While PHP will show you the line number on which it has detected an error, you have to beaware that that is not always the line to which you should go in order to make a repair. A for- gotten close-quote or neglected semicolon sometimes is not picked up by the interpreter untilseveral lines later, so you should be prepared to go back a bit to look for syntax errors of thatkind. Error reportingWhen the PHP interpreter places an error message in a program s output (most often resultingin the error message being displayed in a browser window), it s engaging in error reporting. Error reporting is a useful diagnostic tool that s turned on be default, but which should bedisabled on any PHP interpreter associated with a production server. Error reporting is turned on and off in php.ini. The key value is display_errors. If youwant errors to be rendered as part of your output, this line should appear in php.ini: display_errors=On36
We would like to recommend you tested and proved virtual web hosting services, which you will surely find to be of great quality.

Leave a Reply