precise logging of message filter runs and actions
Categories
(MailNews Core :: Filters, enhancement)
Tracking
(Not tracked)
People
(Reporter: aceman, Assigned: aceman)
References
(Blocks 4 open bugs)
Details
Attachments
(1 file, 3 obsolete files)
(deleted),
patch
|
aceman
:
review+
|
Details | Diff | Splinter Review |
Comment 2•11 years ago
|
||
Comment 5•10 years ago
|
||
Comment 7•10 years ago
|
||
Comment 8•10 years ago
|
||
Comment 10•8 years ago
|
||
Comment 11•8 years ago
|
||
Updated•8 years ago
|
Comment 12•8 years ago
|
||
Comment 13•7 years ago
|
||
Updated•6 years ago
|
Updated•6 years ago
|
Updated•6 years ago
|
Assignee | ||
Comment 14•6 years ago
|
||
This is a crude version of the NSPR filter logging. To enable you set MOZ_LOG=Filters:5 to watch the Filters module.
Please see if this is going in the right direction. I will also go through the comments here and polish some parts, e.g. comment 13 isn't yet incorporated.
Comment 15•6 years ago
|
||
Comment 16•6 years ago
|
||
Aceman,
I think it is in the right direction.
However, isn't this filter logging something that should be logged ALWAYS and possibly checkable in the
error/logging console window?
I may be wrong, but I thought this MOZ_LOG thingy is only visible when we set environmental variable under linux version.
Does it behave differently, say, under Windows?
I would rather see the filtering action in gory detail in the error/log window if I set some preference (boolean setting to true).
Otherwise, it would be rather difficult to analyze filtering mishap/error cases.
(I would probably turn such boolean variable ALWAYS ON).
Just an idea.
Comment 17•6 years ago
|
||
Assignee | ||
Comment 18•6 years ago
|
||
(In reply to Wayne Mery (:wsmwk) from comment #15)
I skimmed the
locations where MOZ_LOG(FILTERLOGMODULE is added and I see a good
distribution of logging levels: Warning, Error, Debug, etc.
Thanks.
- Are there any performance concerns with the added code?
There is possibly slight perf penalty because we are fetching some properties of messages and filters for the log messages that we otherwise wouldn't. But it shouldn't be as bad as it is all in the C++ paths. You can test it on the try build, run a filter manually on thousands of messages.
- Can "normal" filter logging be added to partly cover the last paragraph
of Kent's comment 5 where LogLevel::Error occurs (just 9 locations)? I
realize Kent offered it as an alternative to NSPR logging. But it could be
helpful because the filter log is much easier for users to read and enable
than NSPR.
I can try that. You mean the html filter log the user can see, not the Error console.
Also I would be happy to give feedback based on a try build.
There is a try build at
https://treeherder.mozilla.org/#/jobs?repo=try-comm-central&revision=199b611a732291cc90096b804c5e140ebc34af04
Assignee | ||
Comment 19•6 years ago
|
||
(In reply to ISHIKAWA, Chiaki from comment #16)
However, isn't this filter logging something that should be logged ALWAYS and possibly checkable in the
error/logging console window?
I think there would be a very high perf penalty if all these messages went into the Error console. Also it is more complicated from C++ to push something to the console. If the instrumented filter code would be in JS, it would be much easier. There are logging facilities for JS that dump into the Error console.
I may be wrong, but I thought this MOZ_LOG thingy is only visible when we set environmental variable under linux version.
Does it behave differently, say, under Windows?
Yes, you must set the env variable on all platforms.
I would rather see the filtering action in gory detail in the error/log window if I set some preference (boolean setting to true).
Otherwise, it would be rather difficult to analyze filtering mishap/error cases.
(I would probably turn such boolean variable ALWAYS ON).
I agree, but I think that is more complicated.
Even with this log as implemented, you can have the env var permanently enabled and log into a file. Then whe you think you saw a filtering error, you close TB immediately and save the log for analysing.
Assignee | ||
Comment 20•6 years ago
|
||
(In reply to Magnus Melin [:mkmelin] from comment #17)
::: mailnews/base/search/public/nsMsgFilterCore.idl
+%{C++
- void filterTypeName(nsMsgFilterTypeType filterType, nsCString &typeName);
why would you keep this as c++?
I didn't deem it important enough to put it into the public API of some of the object type. But I can put it into some object if you wish. Maybe into nsIMsgFilter or nsIMsgFilterList.
also, seems like an odd signature. I think it should return the name, not
set it to the member
Ok, I can try.
::: mailnews/base/util/nsMsgUtils.cpp
@@ +2064,5 @@+NS_MSG_BASE uint32_t msgKeyToInt(nsMsgKey aMsgKey)
why wouldn't you just print them as unsigned longs. casting could in theory
give a wrong an confusing log
We want to treat nsMsgKey as an opaque object where no caller should assume what type it is and not assume it is a number. Only the selected helpers should know how to convert nsMsgKey to int or something else. Similarly we have msgKeyFromInt().
When would the cast give wrong result?
Comment 21•6 years ago
|
||
(In reply to :aceman from comment #20)
I didn't deem it important enough to put it into the public API of some of
the object type. But I can put it into some object if you wish. M
Yes that would be better.
We want to treat nsMsgKey as an opaque object where no caller should assume
what type it is and not assume it is a number.
That's probably not too useful. It's not like it could change.
should know how to convert nsMsgKey to int or something else. Similarly we
have msgKeyFromInt().
When would the cast give wrong result?
When you have an int that is large enough and would need to be long
Assignee | ||
Comment 22•6 years ago
|
||
(In reply to Magnus Melin [:mkmelin] from comment #21)
We want to treat nsMsgKey as an opaque object where no caller should assume
what type it is and not assume it is a number.
That's probably not too useful. It's not like it could change.
Actually it can change. We made great effort in the 4GB+ folders to decouple it from the numeric offset of a message in the mbox file. It could also change to 64bit if we need in the future.
should know how to convert nsMsgKey to int or something else. Similarly we
have msgKeyFromInt().
When would the cast give wrong result?
When you have an int that is large enough and would need to be long
If we changed it to long (you mean uint64_t) and made the helper return uint64_t then wouldn't the compiler complain in the prinfs? Or you object to the name of the function containing a generic 'int'?
Assignee | ||
Comment 23•6 years ago
|
||
I added the output to filterlog.html as per Wayne's suggestion. It needed the move of the file write from nsIMsgFilter to nsIMsgFilterList. The logging is just rudimentary (and the messages aren't localized for now). The idea is that if user notices weird filter behaviour and visits this log (accessible in the UI) and sees any of the simple errors, we can point him to the full logging for debugging.
Assignee | ||
Comment 24•6 years ago
|
||
(In reply to H from comment #13)
One more thing that would help people finding their filters not working as
expected:
As part of "List of filter hits..." the information about what rule(s)
made the filter select the message, in case that the user selected "Match
any of the following".
I looked at this, but the filter rules are sent as a single expression string into the evaluator whether they match a message or not. At a match, it isn't as easy to display which rule was the one that made the hit. This needs to think out some representation and display of the information. That is more complicated to do int his bug.
But it is a useful idea for the log, please file it as a new bug so it doesn't get lost.
Assignee | ||
Comment 25•6 years ago
|
||
Refreshed after the C++ reformatting in mailnews.
Comment 26•6 years ago
|
||
Assignee | ||
Comment 27•6 years ago
|
||
Thanks, fixed the problems.
Comment 28•6 years ago
|
||
Pushed by mozilla@jorgk.com:
https://hg.mozilla.org/comm-central/rev/dfea600bd2b2
add logging of message filter runs and actions. r=mkmelin
Updated•6 years ago
|
Comment 29•6 years ago
|
||
Would we want to put some documentation on this feature somewhere?
I have some time this holiday week if you give some information regarding this feature.
TIA
Assignee | ||
Comment 30•6 years ago
|
||
While we could theoretically have this in release notes, maybe it is a too level feature for advanced users only.
I think bug 864187 would be a much better candidate for the release notes.
Comment 31•6 years ago
|
||
But worth mentioning on maildev or other places where triagers and support personnel gather.
And it could be included in a (yet to be created?) general debugging SUMO article.
Comment 32•6 years ago
|
||
Comment 33•6 years ago
|
||
Description
•