Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between DEBUG and NODE_DEBUG for nodejs?

I notice that NODE_DEBUG are more explicit than DEBUG, but why they are 2 environnements variables for debug, and how do I decide which to choose?

Thanks for responses.

like image 378
Bruno Sautron Avatar asked Sep 02 '25 09:09

Bruno Sautron


1 Answers

NODE_DEBUG is used by built in util.debuglog. This is used by all nodejs builtin core modules and all the third party packages that decide to use it.

DEBUG is used by debug module. So if you are using any package that is using this module for logging, then you need to use DEBUG.

So depending on which modules you are trying to debug you may need to use one of them or both.

like image 136
hassansin Avatar answered Sep 04 '25 23:09

hassansin