diff --git a/java/src/org/openqa/selenium/remote/RemoteWebDriver.java b/java/src/org/openqa/selenium/remote/RemoteWebDriver.java index a648dc220f6ee..dd4c29d7df626 100644 --- a/java/src/org/openqa/selenium/remote/RemoteWebDriver.java +++ b/java/src/org/openqa/selenium/remote/RemoteWebDriver.java @@ -747,15 +747,25 @@ protected void log(SessionId sessionId, String commandName, Object toLog, When w if (text.length() > 100 && Boolean.getBoolean("webdriver.remote.shorten_log_messages")) { text = text.substring(0, 100) + "..."; } + } else if (commandName.equals(DriverCommand.NEW_SESSION) && toLog instanceof Response) { + Response responseToLog = (Response) toLog; + try { + Map value = (Map) responseToLog.getValue(); + text = new MutableCapabilities(value).toString(); + } catch (ClassCastException ex) { + // keep existing text + } } - // No need to log a screenshot response. + + // No need to log a base64 encoded responses. if ((commandName.equals(DriverCommand.SCREENSHOT) - || commandName.equals(DriverCommand.ELEMENT_SCREENSHOT)) + || commandName.equals(DriverCommand.ELEMENT_SCREENSHOT) + || commandName.equals(DriverCommand.PRINT_PAGE) + || commandName.equals("fullPageScreenshot")) && toLog instanceof Response) { Response responseToLog = (Response) toLog; Response copyToLog = new Response(new SessionId((responseToLog).getSessionId())); - copyToLog.setValue("*Screenshot response suppressed*"); - copyToLog.setStatus(responseToLog.getStatus()); + copyToLog.setValue(String.format("*%s response suppressed*", commandName)); copyToLog.setState(responseToLog.getState()); text = String.valueOf(copyToLog); } diff --git a/java/src/org/openqa/selenium/remote/codec/w3c/W3CHttpResponseCodec.java b/java/src/org/openqa/selenium/remote/codec/w3c/W3CHttpResponseCodec.java index 5f3cbd12e250c..2d9730911adbf 100644 --- a/java/src/org/openqa/selenium/remote/codec/w3c/W3CHttpResponseCodec.java +++ b/java/src/org/openqa/selenium/remote/codec/w3c/W3CHttpResponseCodec.java @@ -76,7 +76,7 @@ public class W3CHttpResponseCodec extends AbstractHttpResponseCodec { public Response decode(HttpResponse encodedResponse) { String content = string(encodedResponse).trim(); LOG.log( - Level.FINE, + Level.FINER, "Decoding response. Response code was: {0} and content: {1}", new Object[] {encodedResponse.getStatus(), content}); String contentType = nullToEmpty(encodedResponse.getHeader(CONTENT_TYPE)); diff --git a/java/src/org/openqa/selenium/remote/http/DumpHttpExchangeFilter.java b/java/src/org/openqa/selenium/remote/http/DumpHttpExchangeFilter.java index a614ceac66ab8..0666f52c09613 100644 --- a/java/src/org/openqa/selenium/remote/http/DumpHttpExchangeFilter.java +++ b/java/src/org/openqa/selenium/remote/http/DumpHttpExchangeFilter.java @@ -22,7 +22,6 @@ import java.util.function.Supplier; import java.util.logging.Level; import java.util.logging.Logger; -import org.openqa.selenium.internal.Debug; import org.openqa.selenium.internal.Require; public class DumpHttpExchangeFilter implements Filter { @@ -31,7 +30,7 @@ public class DumpHttpExchangeFilter implements Filter { private final Level logLevel; public DumpHttpExchangeFilter() { - this(Debug.getDebugLogLevel()); + this(Level.FINER); } public DumpHttpExchangeFilter(Level logLevel) {