The default bug view has changed. See this FAQ.

Consolidate widget debug output, use nspr logging instead of printing to stdout

RESOLVED FIXED in mozilla9

Status

()

Core
Widget: Win32
RESOLVED FIXED
6 years ago
6 years ago

People

(Reporter: jimm, Assigned: bbondy)

Tracking

Trunk
mozilla9
x86
Windows 7
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Reporter)

Description

6 years ago
I have been meaning to get to this ever since we did the big reformat of nsWindow. We have pretty good debug output in various areas in Windows widget which is controlled by nsWindowDbg, but the output goes to mixed locations.
(Assignee)

Comment 1

6 years ago
I have a couple tasks that will require me to add logging so I might as well take this to refresh myself on NSPR logging.
(Assignee)

Updated

6 years ago
Assignee: nobody → netzen
(Reporter)

Comment 2

6 years ago
I would like to see all of this piped through logging or the console, based on a compile switch. I tend to use the console in cases where I need to do some quick debugging.
(Assignee)

Comment 3

6 years ago
You can already use an environment variable called NSPR_LOG_MODULES of the format moduleName:level[, moduleName:level]* to control logging

Another environment variable NSPR_LOG_FILE allows you to set the filename and for windows you can use a special value of WinDebug to go to the debug output window in VS.
(Assignee)

Comment 4

6 years ago
Ref: http://www.mozilla.org/projects/nspr/reference/html/prlog.html#25497
(Assignee)

Comment 5

6 years ago
OK I investigated a bit more and this (see below) seems to be the best option, is convenient, *does not require a restart of Visual Studio*.  

I'll put a comment with the same content (see below) in nsDef.h so we can update it over time as more logging is added and we can refer there as a reference.  I can change if you really want but I think it is flexible and matches the rest of the modules we log in Firefox/Core/Other.  If you want it to be compile time instead we could programatically set the env variables but I think this is not needed.  Likewise re-implementing the same logging to stdout/debug window/file that already exists in NSPR logging with compile time options seems like it is uneeded too.

---

Logging can be changed at runtime without recompiling in the General property page of Visual Studio under the "Environment" property.

Two variables are of importance to be set: NSPR_LOG_MODULES and NSPR_LOG_FILE

NSPR_LOG_MODULES:
NSPR_LOG_MODULES=all:5 (To log everything completely)
NSPR_LOG_MODULES=nsWindow:5,nsSound:5,nsClipboard:5 (To log windows widget stuff)

NSPR_LOG_FILE:
NSPR_LOG_FILE=C:\nsprlog.txt   (To a file on disk)
NSPR_LOG_FILE=WinDebug         (To the debug window)
NSPR_LOG_FILE=                 (To stdout/stderr)
(Assignee)

Comment 6

6 years ago
Created attachment 552100 [details] [diff] [review]
Patch for normalizing logging

Since this task is in particular prone to rebasing, if you don't mind, I'd prefer a review on this one before my other reviews.
Attachment #552100 - Flags: review?(jmathies)
(Reporter)

Comment 7

6 years ago
Comment on attachment 552100 [details] [diff] [review]
Patch for normalizing logging

woot! I like it. Let's run it past roc though to be sure he's ok with the changes.
Attachment #552100 - Flags: superreview?(roc)
Attachment #552100 - Flags: review?(jmathies)
Attachment #552100 - Flags: review+
Comment on attachment 552100 [details] [diff] [review]
Patch for normalizing logging

Review of attachment 552100 [details] [diff] [review]:
-----------------------------------------------------------------

Nice
Attachment #552100 - Flags: superreview?(roc) → superreview+
http://hg.mozilla.org/mozilla-central/rev/5af0f68f2320
Status: NEW → RESOLVED
Last Resolved: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla9
You need to log in before you can comment on or make changes to this bug.