diff --git a/google-cloud-logging/src/main/java/com/google/cloud/logging/LoggingHandler.java b/google-cloud-logging/src/main/java/com/google/cloud/logging/LoggingHandler.java index 8acad5a41..07f9fcd9e 100644 --- a/google-cloud-logging/src/main/java/com/google/cloud/logging/LoggingHandler.java +++ b/google-cloud-logging/src/main/java/com/google/cloud/logging/LoggingHandler.java @@ -453,9 +453,9 @@ public Boolean getAutoPopulateMetadata() { * the Json format that can be parsed by the logging agent. If set to {@code false}, logs will be * ingested to Cloud Logging by calling Logging API. * - *

This method is mutually exclusive with {@link #setLogTarget()}. + *

This method is mutually exclusive with {@link #setLogTarget(LogTarget)}. * - * @deprecated Use {@link #setLogTarget()}. + * @deprecated Use {@link #setLogTarget(LogTarget)}. */ @Deprecated public void setRedirectToStdout(boolean value) { @@ -475,7 +475,7 @@ public Boolean getRedirectToStdout() { * to the corresponding stream in the Json format that can be parsed by the logging agent. If set * to CLOUD_LOGGING, logs will be sent directly to the Google Cloud Logging API. * - *

This method is mutually exclusive with {@link #setRedirectToStdout()}. + *

This method is mutually exclusive with {@link #setRedirectToStdout(boolean)}. */ public void setLogTarget(LogTarget value) { this.logTarget = value; diff --git a/google-cloud-logging/src/test/java/com/google/cloud/logging/LoggingHandlerTest.java b/google-cloud-logging/src/test/java/com/google/cloud/logging/LoggingHandlerTest.java index a03ac04bf..502612c23 100644 --- a/google-cloud-logging/src/test/java/com/google/cloud/logging/LoggingHandlerTest.java +++ b/google-cloud-logging/src/test/java/com/google/cloud/logging/LoggingHandlerTest.java @@ -32,6 +32,7 @@ import com.google.gson.JsonParser; import java.io.ByteArrayOutputStream; import java.io.PrintStream; +import java.io.UnsupportedEncodingException; import java.util.logging.ErrorManager; import java.util.logging.Filter; import java.util.logging.Formatter; @@ -398,14 +399,15 @@ public void testEnhancedLogEntry() { handler.publish(newLogRecord(Level.FINEST, MESSAGE)); } - void validateJsonOutput(ByteArrayOutputStream bout) { + void validateJsonOutput(ByteArrayOutputStream bout) throws UnsupportedEncodingException { final String expectedOutput = "{\"severity\":\"INFO\",\"time\":\"1970-01-02T10:17:36.789Z\",\"logging.googleapis.com/labels\":{\"enhanced\":\"true\"},\"logging.googleapis.com/trace_sampled\":false,\"message\":\"message\"}"; - assertEquals(JsonParser.parseString(expectedOutput), JsonParser.parseString(bout.toString())); + assertEquals( + JsonParser.parseString(expectedOutput), JsonParser.parseString(bout.toString("UTF-8"))); } @Test - public void testEnhancedLogEntryPrintToStdout() { + public void testEnhancedLogEntryPrintToStdout() throws UnsupportedEncodingException { outputStreamPatcher.patch(); replay(options, logging); @@ -422,7 +424,7 @@ public void testEnhancedLogEntryPrintToStdout() { } @Test - public void testEnhancedLogEntryPrintToStderr() { + public void testEnhancedLogEntryPrintToStderr() throws UnsupportedEncodingException { outputStreamPatcher.patch(); replay(options, logging);