Skip to content
This repository has been archived by the owner on Jan 19, 2022. It is now read-only.

Fix reading log format #2377

Merged
merged 2 commits into from
May 19, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -27,7 +27,7 @@
import com.google.cloud.logging.LogEntry;
import com.google.cloud.logging.Logging;
import com.google.cloud.logging.LoggingOptions;
import com.google.cloud.logging.Payload.StringPayload;
import com.google.cloud.logging.Payload.JsonPayload;
import com.google.devtools.cloudtrace.v1.GetTraceRequest;
import com.google.devtools.cloudtrace.v1.Trace;
import com.google.devtools.cloudtrace.v1.TraceServiceGrpc;
Expand Down Expand Up @@ -155,7 +155,8 @@ public void testTracesAreLoggedCorrectly() {


List<String> logContents = logEntries.stream()
.map((logEntry) -> ((StringPayload) logEntry.getPayload()).getData())
.map((logEntry) -> (String) ((JsonPayload) logEntry.getPayload())
.getDataAsMap().get("message"))
.collect(Collectors.toList());

assertThat(logContents).contains("starting busy work");
Expand Down