Bug 535722 - Reduce the amount of logging for default log levels

Include the URI on success/fail requests and only trace log the onStartRequest. Switch various debug messages to trace and remove importing Log4Moz in fx-weave-overlay and generic-change. Drop the rootLogger to Debug to not log trace messages from unpreffed loggers.
This commit is contained in:
Edward Lee 2009-12-17 18:51:55 -08:00
Родитель 6d5a688ec4
Коммит 5e3b42f790
5 изменённых файлов: 18 добавлений и 37 удалений

Просмотреть файл

@ -262,7 +262,7 @@ Engine.prototype = {
return "Total (ms): " + sums.sort(order).join(", ");
};
this._log.info(stats);
this._log.debug(stats);
}
},
@ -347,7 +347,7 @@ SyncEngine.prototype = {
// Any setup that needs to happen at the beginning of each sync.
// Makes sure crypto records and keys are all set-up
_syncStartup: function SyncEngine__syncStartup() {
this._log.debug("Ensuring server crypto records are there");
this._log.trace("Ensuring server crypto records are there");
// Try getting/unwrapping the crypto record
let meta = CryptoMetas.get(this.cryptoMetaURL);
@ -391,7 +391,7 @@ SyncEngine.prototype = {
// NOTE: we use a backdoor (of sorts) to the tracker so it
// won't save to disk this list over and over
if (!this.lastSync) {
this._log.info("First sync, uploading all items");
this._log.debug("First sync, uploading all items");
this._tracker.clearChangedIDs();
[i for (i in this._store.getAllIDs())]
.forEach(function(id) this._tracker.changedIDs[id] = true, this);
@ -406,7 +406,7 @@ SyncEngine.prototype = {
// Generate outgoing records
_processIncoming: function SyncEngine__processIncoming() {
this._log.debug("Downloading & applying server changes");
this._log.trace("Downloading & applying server changes");
// Figure out how many total items to fetch this sync; do less on mobile
let fetchNum = 1500;
@ -614,7 +614,7 @@ SyncEngine.prototype = {
_uploadOutgoing: function SyncEngine__uploadOutgoing() {
let outnum = [i for (i in this._tracker.changedIDs)].length;
if (outnum) {
this._log.debug("Preparing " + outnum + " outgoing records");
this._log.trace("Preparing " + outnum + " outgoing records");
// collection we'll upload
let up = new Collection(this.engineURL);

Просмотреть файл

@ -235,23 +235,15 @@ Resource.prototype = {
status = channel.responseStatus;
success = channel.requestSucceeded;
if (success) {
this._log.debug(action + " success: " + status);
if (this._log.level <= Log4Moz.Level.Trace)
this._log.trace(action + " Body: " + this._data);
}
else {
let log = "debug";
let mesg = action + " fail: " + status;
// Only log the full response body (may be HTML) when Trace logging
if (this._log.level <= Log4Moz.Level.Trace) {
log = "trace";
mesg += " " + this._data;
}
this._log[log](mesg);
}
// Log the status of the request
let mesg = [action, success ? "success" : "fail", status,
channel.URI.spec].join(" ");
if (mesg.length > 200)
mesg = mesg.substr(0, 200) + "…";
this._log.debug(mesg);
// Additionally give the full response body when Trace logging
if (this._log.level <= Log4Moz.Level.Trace)
this._log.trace(action + " body: " + this._data);
// this is a server-side safety valve to allow slowing down clients without hurting performance
if (headers["X-Weave-Backoff"])
@ -314,19 +306,8 @@ function ChannelListener(onComplete, onProgress, logger) {
}
ChannelListener.prototype = {
onStartRequest: function Channel_onStartRequest(channel) {
// XXX Bug 482179 Some reason xpconnect makes |channel| only nsIRequest
channel.QueryInterface(Ci.nsIHttpChannel);
let log = "trace";
let mesg = channel.requestMethod + " request for " + channel.URI.spec;
// Only log a part of the uri for logs higher than trace
if (this._log.level > Log4Moz.Level.Trace) {
log = "debug";
if (mesg.length > 200)
mesg = mesg.substr(0, 200) + "...";
}
this._log[log](mesg);
this._log.trace(channel.requestMethod + " " + channel.URI.spec);
this._data = '';
},

Просмотреть файл

@ -1023,7 +1023,7 @@ WeaveSvc.prototype = {
return;
}
this._log.debug("Next sync in " + Math.ceil(interval / 1000) + " sec.");
this._log.trace("Next sync in " + Math.ceil(interval / 1000) + " sec.");
Utils.delay(function() this.syncOnIdle(), interval, this, "_syncTimer");
// Save the next sync time in-case sync is disabled (logout/offline/etc.)

Просмотреть файл

@ -104,7 +104,7 @@ let Utils = {
let thisArg = this;
let notify = function(state) {
let mesg = prefix + name + ":" + state;
thisArg._log.debug("Event: " + mesg);
thisArg._log.trace("Event: " + mesg);
Observers.notify(mesg, subject);
};

Просмотреть файл

@ -19,7 +19,7 @@ pref("extensions.weave.engine.tabs.filteredUrls", "^(about:blank|chrome://weave/
pref("extensions.weave.log.appender.console", "Warn");
pref("extensions.weave.log.appender.dump", "Error");
pref("extensions.weave.log.appender.debugLog", "Trace");
pref("extensions.weave.log.rootLogger", "Trace");
pref("extensions.weave.log.rootLogger", "Debug");
pref("extensions.weave.log.logger.service.main", "Debug");
pref("extensions.weave.log.logger.authenticator", "Debug");
pref("extensions.weave.log.logger.network.resources", "Debug");