-
Notifications
You must be signed in to change notification settings - Fork 30.9k
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
console.error/warn causes problem with GCP Cloud logging #53665
Comments
Duplicate of #53661 This is the same issue, but in a different context. |
Linking this message from @joyeecheung, @Triskae do you have any comment on the TTY detection? If so, I apologize for prematurely closing this issue, as it seems like a duplicate |
TTY detection ? I'm sorry I don't have knowledge about this ? I don't know if it as something to do with TTY Using console.log, solves the issue, since log doesn't seem to add anything to the printed string |
Got it! Thanks. See the linked issue for the discussion on coloring. |
The colorization should only happen if your stderr is directed to a terminal. For cloud logging I imagine they would locally pipe the stderr somewhere else (a file or a socket or a pipe) to send the logs over to the server for the users to see in their console (e.g. the browser), in that case the stderr won’t be colorized. Unless GCP tricks Node.js into thinking the stderr is a (pseudo) TTY. |
Version
20.15.0
Platform
Subsystem
No response
What steps will reproduce the bug?
use console.error with a nodejs program running and logging to GCP Cloud Logging
How often does it reproduce? Is there a required condition?
Use console.error and it will break the log format.
What is the expected behavior? Why is that the expected behavior?
The expected behaviour is that nothing is added to the string being printed. Since Cloud Logging needs a valid JSON, the following log is outputed:
this is NOT a valid JSON.
What do you see instead?
instead of
Additional information
Linked to this issue: 53661
And this PR: 51629
The text was updated successfully, but these errors were encountered: