Closed Bug 660369 Opened 9 years ago Closed 8 years ago
Consolidate widget debug output, use nspr logging instead of printing to stdout
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.
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.
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.
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.
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)
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.
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.
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+
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla9
You need to log in before you can comment on or make changes to this bug.