Closed Bug 1417185 Opened 7 years ago Closed 6 years ago

Reintroduce a way to make ConsoleService shut up

Categories

(Core :: XPCOM, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla59
Tracking Status
firefox59 --- fixed

People

(Reporter: mayhemer, Assigned: mayhemer)

References

Details

Attachments

(1 file, 2 obsolete files)

Bug 1414150 removed consoleservice.enabled pref that was a (relatively) convenient way to disable debug output of JS console to VS output window.  It otherwise renders using tracepoints in VS impossible because of all the flood.

No idea why that pref has been removed.  There has to be some way except hacking the code to disable this, preferably with an env var or at least with reintroduction of that or some other pref.
Assignee: nobody → honzab.moz
Status: NEW → ASSIGNED
Attached patch v1 (obsolete) — Splinter Review
this is the most convenient solution for me.  set the env var in my run-in-debugger env (visual studio) and be independent of a profile I run at, since I often delete the whole profile dir to start over which looses the preferences.

by default the behavior is identical as before the patch when nothing is specified.  the env var only disables the OutputDebugString part on windows, nothing else.
Attachment #8942699 - Flags: review?(nchen)
Comment on attachment 8942699 [details] [diff] [review]
v1

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

::: xpcom/base/nsConsoleService.cpp
@@ +53,5 @@
>  NS_IMPL_CI_INTERFACE_GETTER(nsConsoleService, nsIConsoleService, nsIObserver)
>  
>  static const bool gLoggingEnabled = true;
>  static const bool gLoggingBuffered = true;
> +static bool gLoggingToDebugger = true;

I would enclose this in `#ifdef XP_WIN` to make it clear it's Windows only.

@@ +80,5 @@
> +  // To disable OutputDebugString set:
> +  //   MOZ_CONSOLESERVICE_DISABLE_DEBUGGER_OUTPUT=1
> +  //
> +  const char* disableDebugLoggingVar = getenv("MOZ_CONSOLESERVICE_DISABLE_DEBUGGER_OUTPUT");
> +  gLoggingToDebugger = !disableDebugLoggingVar || (disableDebugLoggingVar[0] == '1');

I think you want `!= '1'`
Attachment #8942699 - Flags: review?(nchen) → review+
(In reply to Jim Chen [:jchen] [:darchons] from comment #2)
> I would enclose this in `#ifdef XP_WIN` to make it clear it's Windows only.

had the same idea, yes.

> > +  gLoggingToDebugger = !disableDebugLoggingVar || (disableDebugLoggingVar[0] == '1');
> 
> I think you want `!= '1'`

yes!  I reversed the logic at the end (originally had _ENABLE_ var) and left this unfixed, good catch, thanks!
Attached patch v1.1Splinter Review
(correct reviewer in cm)
Attachment #8943013 - Attachment is obsolete: true
Attachment #8943014 - Flags: review+
Keywords: checkin-needed
Pushed by nbeleuzu@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/1f3711534710
Introduce MOZ_CONSOLESERVICE_DISABLE_DEBUGGER_OUTPUT env var to prevent nsConsoleService from flooding debugger's output window, r=jchen
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/1f3711534710
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla59
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: