-
Notifications
You must be signed in to change notification settings - Fork 29.2k
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
process.stdout.write calls don't show in the console from node2 debug sessions #19750
Comments
Note: if you change to |
The issue is also present on Mac |
+1, this only happens when using |
Assigning to @roblourens to do an initial investigation since it only happens with |
Which version of node? Can you set |
@roblourens, version 7.5.0 I have just tested with 6.9.5 (latest LTS), and this has the same issues. |
Thanks, I'm looking for the full log though, Do the messages show up in chrome devtools? If you debug with |
This is what I've just uploaded. I'm not using chrome-debug here. I'm not sure what you mean with the last question. If you want to know if there is any output when I run the application with node --inspect, yes there is. |
I can confirm it's only using $ node -v
v6.9.1 Running the task with Verbose logs are written to C:\Users\JFORSY~1\AppData\Local\Temp\vscode-node-debug2.txt
4:44:18 PM, 2/6/2017
OS: win32 ia32
Adapter node: v6.5.0 ia32
vscode-chrome-debug-core: 3.11.7
node-debug2: 1.9.12
node --inspect=37775 --debug-brk --nolazy c:\dev\project/debugall.js
Discovering targets via http://127.0.0.1:37775/json
Debugger listening on port 37775.
Warning: This is an experimental feature and could change at any time.
Paused on entry
Target node version: v6.9.1 x64 The debug file has some potentially sensitive information in it, so I won't post the full thing (I can email if you'd like) but the important bits, I think, are here:
There are many (6000+) of these last lines (From target:) A couple more things that may or may not help: using |
I just found out that the problem is not with So you can reproduce this. Make a new .js file with |
@pkeuter Sorry you're right, that is the right file. I was looking for the messages from node containing the log messages, but they are missing. I actually had seen this on someone else's computer last week but couldn't repro it under the same conditions. Are you saying that console.log output shows up, but process.stdout.write doesn't? I wouldn't expect process.stdout.write output to show up, because node2 isn't listening to the process' stdout. It only gets log messages over the debug socket from console.log. You can check this by running with |
By the way, Winston is using process.stdout.write, that's why I noticed: |
Yeah, it will show up in the console output you see, because that's just showing stdout. In 1.9 we switched from showing stdout to showing log messages from the debug protocol. There are a couple advantages to this, mainly that you can now log an object, and see an actual expandable object in the console, instead of just text like before. We could listen to stdout as well, but then we would have to de-dupe messages between the two channels so that we don't show them twice. And if we do that, you could have an issue with message ordering. They might come over stdout faster than the debug protocol, and I think that showing messages in the wrong order is worse than not showing them at all. Thanks for pointing out that Winston uses that - searching around a little, this might end up being a common issue. |
@jdforsythe Are you also using |
@roblourens That sounds like a bad solution indeed. You could make it a setting though (showing stdout vs showing debug protocol)? With the way it is now as default. But you probably already thought of this :-) Or you might do process.stdout.write = console.log, but this is obviously even uglier, haha. |
Yeah, I think we might want a setting for this. I also opened an issue on Winston - winstonjs/winston#981 - so I'm curious what they will say. |
Yeah, me too! I'll keep following that. Thanks. |
@roblourens We are also using winston |
@roblourens It looks like they specifically made the change from console.log: I made a PR to winston to add a setting for the console transport to use console.log/console.error. It fixes this issue. I still have no output with nodemon using this, but in a regular launch configuration it works. Fix PR: winstonjs/winston#982 |
Thanks for making the PR, but I hope we can find a solution that works out of the box for everyone. |
The Insider's build now has the |
@roblourens Just tested the latest Insider Build, only debug and error output are showing in the debug console when using Winston. |
Do those actually get written to stdout? |
@roblourens any hints on if this will be a part of minor release or patch release? Very excited to see this finally getting sorted out. |
You can use it today in the Insiders build. https://code.visualstudio.com/insiders |
Honestly I don't expect to find a better solution than opting into showing stdout/err directly with the new outputCapture option, (or |
Verification steps: Debug this node script: console.log('this is from console.log');
process.stdout.write('this is from process.stdout.write\n')
|
verified with Node 8.1.1 |
verified with v8.4.0 |
I tried to use |
Yes, we can't capture the stdout when attaching to a running process. |
Is this going to be a permanent issue? After updating node to the latest version I am seeing winston logging problems on several applications |
Yes but you can set |
|
More of an FYI since using Using VS Code v1.17.2 and node v6.11.4 on my Windows machine I was not able to capture console.log() output in the Debug Console without adding However using VS Code v1.17.0 and node v6.9.4 on my CentOS machine I was able to capture console.log() output in the Debug Console without adding I'm running the same exact code, but getting different results based on OS and slightly different VS Code and Node versions. |
I've tested using VSCode 1.18.0 and suggested node versions. //launch.json:
{
"version": "0.2.0",
"configurations": [{
"type": "node",
"request": "launch",
"runtimeExecutable": "/home/user/.nvm/versions/node/v6.9.4/bin/node",
"name": "Launch Program",
"outputCapture": "std",
"program": "${workspaceRoot}/main.js"
}]
} //main.js:
console.log('test'); Logging works well on both: @GitFlip could you please check your code using VSCode 1.18 and provide more details (e.g. simplified source code). |
Please open a new issue with details |
Steps to Reproduce:
The new update appears to have broken the debug output. Previously we would get the following when launching the debug task:
This would then be followed by the normal debug output from our project. Now when we run the debug task, the above is the only thing showing in the debug console. The application functions normally so it is running, but no output is shown.
launch.json
:The text was updated successfully, but these errors were encountered: