Skip to content

Logging to stdout in Cloud Run creates a JSON object as "message" #704

@SoftMemes

Description

@SoftMemes

Environment details

  • OS: Ubuntu 20 LTS
  • Node.js version: v16.14.2
  • npm version: yarn 3.2.0
  • @google-cloud/logging-winston version: 4.2.3

Steps to reproduce

When enabling structured logging to STDOUT, I do recieve a structured JSON payload as output, that is picked up by Stackdriver from the Cloud Run logs, so far so good. The "message" however, is in itself a JSON payload containing a "message" key with the original logged message, as well as a "metadata" key of an empty object. As a result, each line in my log output in Stackdriver shows a JSON object (that can then be expanded to show the outer JSON object).

I have attempted to change the format that Windsor is using, but it does not appear to be a problem at that level, without this transport, I am seeing plain text "message" output.

Is there a way to prevent this extra level of object being created and instead have the "message" be just the string I've logged?

Metadata

Metadata

Assignees

Labels

api: loggingIssues related to the googleapis/nodejs-logging-winston API.priority: p2Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions