Closed
Bug 673309
Opened 13 years ago
Closed 13 years ago
Differentiate error and success logs in filename
Categories
(Firefox :: Sync, defect)
Firefox
Sync
Tracking
()
VERIFIED
FIXED
mozilla8
People
(Reporter: philikon, Assigned: liuche)
References
Details
(Whiteboard: [good first bug][verified in services])
Attachments
(1 file, 2 obsolete files)
(deleted),
patch
|
philikon
:
review+
christian
:
approval-mozilla-aurora-
|
Details | Diff | Splinter Review |
This would be handy to visually distinguish errors and success if one has logOnSuccess enabled. It would also be handy for the clean up (bug 663181) so that errors and success logs could be cleaned up separately (and potentially at a different pace)
Assignee | ||
Updated•13 years ago
|
Assignee: nobody → liuche
Assignee | ||
Comment 1•13 years ago
|
||
added prefixes "success-" and "err-" to successful/erroneous sync logs. Also added unit-tests to check output filenames.
Attachment #547825 -
Flags: review?(rnewman)
Comment 2•13 years ago
|
||
Comment on attachment 547825 [details] [diff] [review]
success-/err- logfile prefixes
Review of attachment 547825 [details] [diff] [review]:
-----------------------------------------------------------------
Note "User" in hg patch header. See <http://blog.bonardo.net/2010/06/22/so-youre-about-to-use-checkin-needed>.
r- to take care of minor points below.
::: services/sync/modules/service.js
@@ +478,5 @@
> fapp.level = Log4Moz.Level[Svc.Prefs.get("log.appender.file.level")];
> root.addAppender(fapp);
> },
>
> + _resetFileLog: function resetFileLog(flushToFile, isError) {
Nit: try to make the two names agree.
@@ +483,5 @@
> let inStream = this._logAppender.getInputStream();
> this._logAppender.reset();
> if (flushToFile && inStream) {
> try {
> + let filename = ((isError) ? "err-" : "success-") + Date.now() + ".log";
I'd prefer:
_resetFileLog: function(flushToFile, filenamePrefix) {
and then calling it with LOG_PREFIX_ERROR or LOG_PREFIX_SUCCESS, defined at the top of the file.
Boolean args are usually a red flag to me (pun intended): you can't tell from an invocation of _resetFileLog what the second argument is supposed to do, and it doesn't generalize at all.
http://mark-story.com/posts/view/the-argument-for-flag-arguments
@@ +531,5 @@
> !Services.io.offline) {
> this._ignorableErrorCount += 1;
> } else {
> + this._resetFileLog(Svc.Prefs.get("log.appender.file.logOnError"),
> + true);
Nit: indentation. Align your arguments.
@@ +546,5 @@
> this.logout();
> break;
> default:
> + this._resetFileLog(Svc.Prefs.get("log.appender.file.logOnError"),
> + true);
Ditto.
@@ +551,5 @@
> break;
> }
> break;
> case "weave:service:sync:finish":
> + this._resetFileLog(Svc.Prefs.get("log.appender.file.logOnSuccess"),
Ditto.
::: services/sync/tests/unit/test_service_filelog.js
@@ +71,5 @@
> let entries = logsdir.directoryEntries;
> do_check_true(entries.hasMoreElements());
> let logfile = entries.getNext().QueryInterface(Ci.nsILocalFile);
> do_check_eq(logfile.leafName.slice(-4), ".log");
> + do_check_eq(logfile.leafName.slice(0,8), "success-");
Update these to use the constants, of course.
Attachment #547825 -
Flags: review?(rnewman) → review-
Reporter | ||
Comment 3•13 years ago
|
||
> _resetFileLog: function(flushToFile, filenamePrefix) {
>
> and then calling it with LOG_PREFIX_ERROR or LOG_PREFIX_SUCCESS, defined at
> the top of the file.
>
> Boolean args are usually a red flag to me (pun intended): you can't tell
> from an invocation of _resetFileLog what the second argument is supposed to
> do, and it doesn't generalize at all.
I agree about const'ing the values. I would also like to use "error-..." instead of "err-". However, I still think that the logic which prefix should be used should live in _resetFileLog, not in the observers.
> @@ +531,5 @@
> > !Services.io.offline) {
> > this._ignorableErrorCount += 1;
> > } else {
> > + this._resetFileLog(Svc.Prefs.get("log.appender.file.logOnError"),
> > + true);
>
> Nit: indentation. Align your arguments.
Also, never indent with tabs please. Ever. :)
Comment 4•13 years ago
|
||
(In reply to comment #3)
> I agree about const'ing the values. I would also like to use "error-..."
> instead of "err-". However, I still think that the logic which prefix should
> be used should live in _resetFileLog, not in the observers.
Sure; the important point is that it's not "true" or "false".
(Using consts which happen to be the actual prefixes just saves some work inside _resetFileLog -- i.e., "the logic" is "the identity function" :))
Reporter | ||
Comment 5•13 years ago
|
||
Comment on attachment 547825 [details] [diff] [review]
success-/err- logfile prefixes
># HG changeset patch
># Parent 5d1799e16fe9991cf7c468a6dc35e0049fdb3543
># User Philipp von Weitershausen <philipp@weitershausen.de>
Also, you probably want to update your .hgrc file, unless you want me to take credit for your work ;)
Assignee | ||
Comment 6•13 years ago
|
||
Attachment #547825 -
Attachment is obsolete: true
Attachment #547845 -
Flags: review?(rnewman)
Assignee | ||
Comment 7•13 years ago
|
||
username filled from .hgrc, fixed some indentation, .log changed to .txt
Attachment #547845 -
Attachment is obsolete: true
Attachment #547845 -
Flags: review?(rnewman)
Attachment #547854 -
Flags: review?(philipp)
Reporter | ||
Comment 8•13 years ago
|
||
Comment on attachment 547854 [details] [diff] [review]
username, indentation, .log->.txt
r=philikon
Attachment #547854 -
Flags: review?(philipp) → review+
Reporter | ||
Comment 9•13 years ago
|
||
Status: NEW → ASSIGNED
Whiteboard: [good first bug] → [good first bug][fixed in services]
Assignee | ||
Comment 10•13 years ago
|
||
STR
To enable logging for successful sync, toggle services.sync.log.appender.file.logOnSuccess to true. Erroneous sync should always cause logging.
Sync using Tools->Sync Now.
If sync is successful, about:sync-log should have a log file of the form "success-<#>.txt" (e.g. success-13913898319.txt).
To test error sync, somehow cause an erroneous sync. about:sync-log should contain a log file of the form "error-<#>.txt"
Comment 11•13 years ago
|
||
verified on nightly s-c builds of 20110725
Whiteboard: [good first bug][fixed in services] → [good first bug][verified in services]
Reporter | ||
Comment 12•13 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla8
Reporter | ||
Comment 13•13 years ago
|
||
Comment on attachment 547854 [details] [diff] [review]
username, indentation, .log->.txt
Requesting approval for Aurora because apparently Fennec isn't too happy about '.log' files (see bug 673674). To cope with that Fennec bug, we can simply transplant this patch which makes Sync use the '.txt' file ending.
Patch has minimal risk and is already verified by QA.
Attachment #547854 -
Flags: approval-mozilla-aurora?
Comment 14•13 years ago
|
||
Comment on attachment 547854 [details] [diff] [review]
username, indentation, .log->.txt
We're going to pass on this for aurora. We'll let it bubble up through the normal process
Attachment #547854 -
Flags: approval-mozilla-aurora? → approval-mozilla-aurora-
Reporter | ||
Comment 15•13 years ago
|
||
(In reply to comment #14)
> We're going to pass on this for aurora. We'll let it bubble up through the
> normal process
Thanks Christian. Please do note that unless bug 673674 landed for Fennec 7, this would mean that Fennec 7 users would not be able to view Sync logs.
Comment 16•13 years ago
|
||
Yep, we're waiting for bug 673674 to be nominated
Updated•13 years ago
|
Status: RESOLVED → VERIFIED
Updated•6 years ago
|
Component: Firefox Sync: Backend → Sync
Product: Cloud Services → Firefox
You need to log in
before you can comment on or make changes to this bug.
Description
•