diff --git a/functions/snippets/src/main/java/com/example/functions/LogHelloWorld.java b/functions/snippets/src/main/java/com/example/functions/LogHelloWorld.java index 64457523ce4..944330f348e 100644 --- a/functions/snippets/src/main/java/com/example/functions/LogHelloWorld.java +++ b/functions/snippets/src/main/java/com/example/functions/LogHelloWorld.java @@ -32,6 +32,10 @@ public class LogHelloWorld implements HttpFunction { @Override public void service(HttpRequest request, HttpResponse response) throws IOException { + System.out.println("I am a log to stdout!"); + System.err.println("I am a log to stderr!"); + + // Stackdriver does not detect severity from Cloud Functions log output LOGGER.info("I am an info log!"); LOGGER.warning("I am a warning log!"); diff --git a/functions/snippets/src/test/java/com/example/functions/SnippetsTests.java b/functions/snippets/src/test/java/com/example/functions/SnippetsTests.java index c13a6aa3b9e..e1736f63bbc 100644 --- a/functions/snippets/src/test/java/com/example/functions/SnippetsTests.java +++ b/functions/snippets/src/test/java/com/example/functions/SnippetsTests.java @@ -90,7 +90,7 @@ public void beforeTest() throws IOException { @After public void afterTest() { - System.setOut(null); + System.out.flush(); logHandler.flush(); }