question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Feature] enable/disable debugging dynamically

See original GitHub issue

Often when one is investigating a ‘live’ issue, one would rather not restart node to enable debugging: this might make the problem disappear until it is triggered again later. Instead debug configuration should be alterable dynamically through some kind of listener (e.g. file watch, socket –the implementation of the listener is not the purpose of this issue, though that would make a nice addition!).

Support for such dynamic changes would be easy to add in debug.js, here the output of diff -n for the current codebase:

a21 1
exports._debuggers = Object.create(null);
a126 1
  exports._debuggers[namespace] = debug;
a155 10
  for (const namespace in exports._debuggers) {
      exports._debuggers[namespace].enabled = false;
      exports.names.some( (pattern) => {
          const match = pattern.test(namespace);
          if (match) {
              exports._debuggers[namespace].enabled = true;
          }
          return match;
      });
  }

With above one can change the debug settings from any place in the code using the same values as passed through the DEBUG environment variable at initialization time:

const debugCore = require('debug');
debugCore.enable('mymod*');

See also issue #419 (and possibly #416 and #425).

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:6
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
geonanorchcommented, Aug 9, 2017

Thanks, will do! Initial feedback in the meantime:

  • unless I missed it in README.md, the feature is not documented
  • the feature is not listed under the release notes for 3.0.0

All the same, thank you for considering and implementing my request 😃

0reactions
Qix-commented, Aug 21, 2020

@tasoss No, as that is a limitation of the operating system. You cannot change an environment variable from outside a process.

Read more comments on GitHub >

github_iconTop Results From Across the Web

[Feature] enable/disable debugging dynamically · Issue #433
I use debug via browserify-as-a-service build(version 3.1.0) and set localStorage. What should I do to disable debug when publish on line?
Read more >
Dynamic debug — The Linux Kernel documentation
Dynamic debug is designed to allow you to dynamically enable/disable kernel code to obtain additional kernel information. Currently, if CONFIG_DYNAMIC_DEBUG is ...
Read more >
Ways to dynamically enable/disable debug features in an APK
Key the debug features off of SharedPreference values, and expose them in a preferences/debug menu in the UI.
Read more >
SM Tip: How to use dynamic debugging feature "Send Debug ...
We need to login to ServiceManager (SM) with two sessions. Session (A) with a SysAdmin user, for example falcon, to set the trace...
Read more >
Enable and disable Edit and Continue - Visual Studio (Windows)
Learn how to disable and enable Edit and Continue in Visual Studio Options at design time. Edit and Continue works only in debug...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found