It can be tough to debug apps that use the offline application cache, because there's very little visibility into what is going on. You may find yourself constantly wondering if your files have downloaded or if you are viewing remote or local resources. Plus, switching your device between online and offline modes is not the snappiest procedure and can really slow down the develop-test-debug cycle.

One thing you can do to help determine what's going on when things aren't playing nice is to set up some console logging in JavaScript.

If you want to see what's happening from the web server's perspective, you can monitor its log files. For example, if you are running a web ' ' 1.4' server on a Mac or Linux computer, you can open the command line (see "Using the Command Line" on page 110), and run these commands (the $ is the shell prompt, which you should not type):

This will display the web server's log entries, showing information such as the date and time a document was accessed, as well as the name of the document. When you are done, press Control-C to stop following the log.

The ? on the second line will match any character; on Ubuntu Linux, the filename is access.log and on the Mac it is access_log. If you are using another version of Linux or if you're on Windows, the name of the file and its location may be different.

0 0

Post a comment