Skip to content

JSON formatter uses wrong time field #1019

@bpcreech

Description

@bpcreech

LogEntry.StructuredLogFormatter.toStructuredJsonString is writing to the wrong time field (or writing the wrong data to it).

The spec states we should use:

  • timestamp with a structure of epoch seconds and nanos, or
  • time with RFC3339 time.

Currently LogEntry.StructuredLogFormatter.toStructuredJsonString is writing RFC3339 time to the timestamp field.

This breaks our parser for our test harness. I'm not sure if it works in all GCP properties which use this format. (Generally the behavior of logging parsers is to fall back to current time, so I would be unsurprised if this is silently failing down to slightly less accurate timestamps in places.)

I'll send a PR.

Metadata

Metadata

Assignees

Labels

api: loggingIssues related to the googleapis/java-logging API.priority: p3Desirable enhancement or 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