Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debug output doesn't appear in debug console without "outputCapture": "std" #41600

Closed
johnshew opened this issue Jan 14, 2018 · 3 comments
Closed
Assignees
Labels
*as-designed Described behavior is as designed debug Debug viewlet, configurations, breakpoints, adapter issues

Comments

@johnshew
Copy link

Version info:

  • VSCode: 1.19.2
  • OS: Windows 10 1709
  • Node: 8.9.3
  • Debug: 3.1.0 (from npm install debug)

To reproduce: create a simple node app that generates debug output using the debug package, Then:

  1. Run the app with launch,json that does not have "outputCapture": "std". No debug output.
  2. Run the app with launch.json that has "outputCapture": "std". Debug output visible.

It appears this issue occurs because debug defaults to sending output directly to process.stderr and the vscode debug console doesn't seem to pick it up unless "outputCapture": "std" is present.

Is this expected behavior from vscode?

Or perhaps my launch.json is misconfigured:

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [

        {
            "type": "node",
            "request": "attach",
            "name": "Attach",
            "port": 9229
        },
        {
            "type": "node",
            "request": "launch",
            "name": "Mocha Tests",
            "program": "${workspaceFolder}/node_modules/mocha/bin/_mocha",
            "args": [
                "-u",
                "tdd",
                "--timeout",
                "999999",
                "--colors",
                "${workspaceFolder}/lib/test"
            ],
            "env": {
                "DEBUG": "*,-mocha:*"
            },
            "outputCapture": "std",
            "internalConsoleOptions": "openOnSessionStart"
        },
        {
            "type": "node",
            "request": "launch",
            "name": "Launch Program",
            "program": "${workspaceFolder}\\lib\\server.js"
        },        
    ]
}
@isidorn isidorn assigned roblourens and unassigned isidorn Jan 15, 2018
@isidorn isidorn added the debug Debug viewlet, configurations, breakpoints, adapter issues label Jan 15, 2018
@roblourens
Copy link
Member

It appears this issue occurs because debug defaults to sending output directly to process.stderr and the vscode debug console doesn't seem to pick it up unless "outputCapture": "std" is present.

This is exactly the case that the outputCapture setting was added to support - many logging packages write directly to the output stream, which isn't sent over Node's debug socket. So that flag switches the debugger to listen to stdout/err instead of log messages over the debug socket.

@roblourens roblourens added the *as-designed Described behavior is as designed label Jan 16, 2018
@johnshew
Copy link
Author

Given the popularity of Debug package in the node community, why not adjust your node.js template auto-generate "outputCapture" : "std"?

I guess more broadly why isn't this just the default all the time?

@roblourens
Copy link
Member

Getting output through the debug socket gives you rich output, not just text. For example if I log an object, I can dynamically inspect that object in the console. This is what people expect coming from tools like chrome devtools.

@vscodebot vscodebot bot locked and limited conversation to collaborators Mar 2, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
*as-designed Described behavior is as designed debug Debug viewlet, configurations, breakpoints, adapter issues
Projects
None yet
Development

No branches or pull requests

3 participants