Showing posts with label debug. Show all posts
Showing posts with label debug. Show all posts

Friday, January 4, 2008

Turning on the Debug File

Net Usage creates a debug file (netusage_debug.txt) whenever an error occurs. When you are trying to create your own ISP script you will want the debug file on all the time. This allows you to check variables, parsing commands and other useful information, even when the script works correctly.

To turn on the debug file follow these steps:
  1. In the address field in Firefox enter about:config and hit Enter.
  2. In the filter box type netusage and hit Enter.
  3. You should see a few lines starting with extensions.netusage.0...
    The 0 in the preference name corresponds to the number of Net Usage meters you have in your browser. For example, if you only have 1 meter you will see preferences starting with extensions.netusage.0. If you have 2 meters you will see preferences with extensions.netusage.0 and extensions.netusage.1 and so on. I will assume you only have one meter in your browser.
  4. Add a new preference to the list by right clicking somewhere in the window and selecting New -> Boolean from the pop up menu. In the dialog enter extensions.netusage.0.debug as the Preference Name. and click OK. Then select True for the preference Value and click OK.
  5. Click on the Show All button on the filter line, then enter netusage in the filter field and hit enter. You should now have a new preference of extensions.netusage.0.debug set to True.
Now every time Netusage retrieves the statistics from the ISP's usage page it will write a debug file called netusage_debug.txt in %AppData%\Mozilla\firefox\Profiles\{Your Profile Directory}. When you have finished with the debug files you can turn them off by going back to the about:config page in Firefox and changing the value we just created to False.

If you need more information on the debug file, have a read of this blog post.

Monday, December 17, 2007

Parsing Errors

More often than not, Net Usage will sit there doing it's thing and you will not experience any problems with it. However, at some time the ISP will change their page and your meter may stop working.

You will know the meter is not working because it will display a white cross in a red circle.

When you hover your mouse over the meter it may indicate a "parsing error" has occurred. If the error is a parsing error a debug file should have been created in the Mozilla Profile directory. The full path to the profile directory on my computer is:
C:\Documents and Settings\Username\Application Data\Mozilla\Firefox\Profiles\8ndbqffi.default\
The easiest way to find the profiles directory on your computer is to click on the Windows Start button and click on Run... (alternatively press the Widows-Logo [] key and the R key at the same time). In the Run dialog enter the following command:
%AppData%\Mozilla\firefox\Profiles\
Then hit Enter. A window should be displayed with a folder named something like 8ndbqffi.default. Your folder name will be different, but it should be the right place. Double-click on the folder to open it and find the netusage_debug.txt file.

If the debug file is not there, go back to firefox and left click on the meter to get Netusage to fetch your data again. You will get another parsing error, then go back to the profiles directory and the netusage_debug.txt file should be there.

This is a normal text file but if you open it in notepad the line-breaks will not be displayed correctly. If you want to see what's in the file, right click on the file and select "Open With" from the menu and then click on WordPad. I prefer a program called notepad++ but WordPad will do for just looking at the contents. Don't edit anything in this file, Critter need this file the way it is to work out why Net Usage is not working correctly.

Once you have finished looking at the contents of the debug file close WordPad and don't save any changes. To fix the problem you will need to email this file to Critter (his email address is at the bottom of the Net Usage homepage).