June 16, 2011

The past

For a long time Firefox Sync has had the ability to write a continuous log of what it’s doing to disk which isĀ  pretty easily accessible via about:sync-log. In the Firefox 4 beta cycle, we disabled the log by default because the disk activity of writing the log can hurt your browser’s performance, particularly on mobile (it also didn’t help that the writes to the log blocked the UI thread.)

Only problem is, having the log disabled by default means that whenever Sync fails somehow, the user won’t have a log of what happened. Right now they have to turn on logging in about:config, restart the browser, and then sync again. That means we really only have a chance of catching reproducible problems, not the intermittent ones.

The future

Last week I spent a few days fixing the logging situation and with today’s nightly (and eventually Firefox 7) things have changed. Sync now keeps the log in memory and usually discards it after a successful sync. If an error occurs, however, the log will be written to a file (but not on the UI thread!) Consequently, about:sync-log has been changed to show you the directory where the individual log files are dumped. The most recent log files will be at the bottom of that listing. (Eventually we might make this a bit prettier, e.g. by taking some inspiration from about:crashes.)

Like before, it’s still possible to tweak logging behaviour in about:config, except now you get two preferences to define what should happen on a failed and successful sync, respectively:

  • services.sync.log.appender.file.logOnError (default: true)
  • services.sync.log.appender.file.logOnSuccess (default: false)

If you had logging enabled before, services.sync.log.appender.file.logOnSuccess will be turned on for you automatically.


We always appreciate it when users let us know about problems they’re experiencing with Sync because it means we can improve it! Here are some guidelines on how to file a good Sync bug:

  1. Get the Sync log on the machine you’re having problems (these steps assume you’re running the latest version of Firefox; if you’re not, please upgrade):
    1. Go to about:sync-log in Firefox.
    2. Find the last log file entry in the list and click on it. It should be called something like 1307991874508.log or error-1307991874508.log.
    3. Save it to a file on disk so you can upload to the bug later.
    4. If the list in step 2 is empty or only contains outdated logs (you can tell by the dates), go to about:config, find the services.sync.log.appender.file.logOnSuccess preference, set it to true, and sync again. Then repeat these steps.
  2. File a bug
    1. Even if you’ve found an existing bug that may look like the one you’re experiencing, do not add your comments to it. Please always file a new bug, we will dupe it appropriately once we’ve determined the root issue. If you want, you can clone the existing bug or make a cross-reference to it in the summary.
    2. Attach the log file you saved earlier to the bug by uploading an attachment. Do not copy & paste the text into the comment field, it won’t hould enough text!

We’re hoping to automate much of this in upcoming versions of Firefox, so that a Sync problem can automatically be reported to us, or at least with just a few clicks.