Skip to content

console.error/warn causes problem with GCP Cloud logging #53665

@Triskae

Description

@Triskae

Version

20.15.0

Platform

Linux redacted 6.1.85+ #1 SMP PREEMPT_DYNAMIC Sat May  4 14:32:43 UTC 2024 x86_64 Linux

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:

"[33m{ "severity": "WARNING", "timestamp": "2024-07-01T07:02:00.349Z", "context": "Main.bootstrap", "message": "API service started" }[39m"

this is NOT a valid JSON.

What do you see instead?

"[33m{ "severity": "WARNING", "timestamp": "2024-07-01T07:02:00.349Z", "context": "Main.bootstrap", "message": "API service started" }[39m"

instead of

"{ "severity": "WARNING", "timestamp": "2024-07-01T07:02:00.349Z", "context": "Main.bootstrap", "message": "API service started" }"

Additional information

Linked to this issue: 53661
And this PR: 51629

Metadata

Metadata

Assignees

No one assigned

    Labels

    duplicateIssues and PRs that are duplicates of other issues or PRs.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions