Services/Sync/Snippets: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
| Line 39: | Line 39: | ||
coll.get(); | coll.get(); | ||
=== Get a log from Fennec === | === Get a log from XUL Fennec === | ||
* View about:sync-log. | * View about:sync-log. | ||
| Line 46: | Line 46: | ||
* Choose "File Manager" as the handler. | * Choose "File Manager" as the handler. | ||
* Navigate to "Downloads", pick correct file. | * Navigate to "Downloads", pick correct file. | ||
=== Watch live Sync logs === | |||
* Set services.sync.log.appender.console to Trace. | |||
Revision as of 08:10, 15 December 2011
For want of a better place, here are some handy snippets for investigating Sync issues.
For most of these your Sync credentials and keys need to have been loaded before running (otherwise you might get errors about there being no key for a collection). Run a sync first.
Print out a list of large bookmark records
Change '1000' as appropriate.
Components.utils.import("resource://services-sync/engines.js");
Components.utils.import("resource://services-sync/engines/bookmarks.js");
let bme = Engines.get("bookmarks");
let ids = Object.keys(bme._store.getAllIDs());
for each (let id in ids) {
let record = bme._store.createRecord(id, "bookmarks");
let len = record.toString().length;
if (len > 1000) {
console.log("ID: " + id + ", len = " + len + ", " + record.title);
}
}
Get a count of the number of members of a collection on the server.
Components.utils.import("resource://services-sync/main.js");
Components.utils.import("resource://services-sync/resource.js");
JSON.parse(new Resource(Weave.Service.storageURL + "passwords").get()).length;
Dump the cleartext of each record in a collection to the console.
Components.utils.import("resource://services-sync/main.js");
Components.utils.import("resource://services-sync/record.js");
let recordType = Weave.Engines.get("passwords")._recordObj;
let coll = new Collection(Weave.Service.storageURL + "passwords", recordType);
coll.full = true;
coll.recordHandler = function(item) {
item.collection = "passwords";
item.decrypt();
console.log(item.cleartext);
};
coll.get();
Get a log from XUL Fennec
- View about:sync-log.
- Long-tap the log in question. Choose "Save Link".
- Open a mail client. Click Attach.
- Choose "File Manager" as the handler.
- Navigate to "Downloads", pick correct file.
Watch live Sync logs
- Set services.sync.log.appender.console to Trace.