CRT-600 practice question 23 of 30
A developer has a web server running with Node.js. The command to start the web server is node server.js. The web server started having latency issues. Instead of a one second turnaround for web requests, the developer now sees a five second turnaround. Which command can the web developer run to see what the module is doing during the latency period?
Full set: 223 questionsThe NODEDEBUG environment variable is a built-in utility in Node.js for enabling debug logging for specific core modules. To investigate latency in a web server, the developer needs to inspect the internal workings of the http and https modules. Setting NODEDEBUG=http,https instructs the Node.js runtime to output detailed, timestamped diagnostic information from these modules to stderr. This allows the developer to trace the request and response lifecycle and identify the specific operations causing the delay.
A. NODEDEBUG requires a comma-separated list of core module names to enable their specific debug logs; a generic value like true is not valid syntax for this purpose.
B. The DEBUG environment variable is conventionally used by user-land modules (e.g., Express.js) that leverage the debug library, not for Node.js core modules like http.
D. The DEBUG variable is for user-land modules, not core Node.js modules, and true is not the standard syntax for enabling specific module logs with it.
1. Node.js Official Documentation
Command-line options
Environment variables: The documentation explicitly defines the usage of NODEDEBUG. It states: "NODEDEBUG=module[
...]: '
'-separated list of core modules that should print debug information." This directly supports the syntax and purpose described in option C.
Source: Node.js v18.17.0 Documentation
"Environment Variables"
NODEDEBUG=module[
...] section.
2. Node.js Official Documentation
util module API: The documentation for util.debuglog(section) explains how this mechanism works internally. It clarifies that logs are enabled when the section name (e.g.
'http') appears in the NODEDEBUG environment variable.
Source: Node.js v18.17.0 Documentation
"Utility Module"
util.debuglog(section[
callback]) section.
Keep practicing
Take the free CRT-600 practice test
Ten exam-style questions with answers and explanations, plus the exam facts and study guides.
More questions
Other CRT-600 practice questions
- Question 2A developer has the function, shown below, that is called when a page loads. function onl…
- Question 3A developer needs to test this function: 01 const sum3 = (arr) => ( 02 if (!arr.length) r…
- Question 4Refer to the code below: Const resolveAfterMilliseconds = (ms) => Promise.resolve ( setTi…
- Question 10Refer to the following code block: class Animal{ constructor(name){ this.name = name; } m…
- Question 11A developer needs to debug a Node.js web server because a runtime error keeps occurring a…
- Question 12Refer to the string below: const str = 'Salesforce'; Which two statements result in the w…
