public List<String> setLogLevel(String namespace, String level, String scope) {
        String resource = "admin/loggers/" + namespace;
        if (scope != null)
            resource += "?scope=" + scope;
        String url = adminEndpoint(resource);
        String body = "{\"level\": \"" + level + "\"}";
        Response response = requestPut(url, body);

        if (response.getStatus() == Response.Status.NO_CONTENT.getStatusCode()) {
            if (response.getEntity() != null && !response.getEntity().equals("")) {
                // Don't use JUnit assertNull here because this library is used by both
                // Connect runtime tests and MirrorMaker 2 tests, which use different
                // versions of JUnit
                throw new AssertionError(
                        "Response with 204 status contained non-null entity: '"
                                + response.getEntity() + "'"
                );
            }
            return null;
        } else if (response.getStatus() < Response.Status.BAD_REQUEST.getStatusCode()) {
            ObjectMapper mapper = new ObjectMapper();
            try {
                return mapper
                        .readerFor(new TypeReference<List<String>>() { })
                        .readValue(responseToString(response));
            } catch (IOException e) {
                log.error("Could not read loggers from response: {}",
                        responseToString(response), e);
                throw new ConnectException("Could not not parse loggers", e);
            }
        } else {
            throw new ConnectRestException(
                    response.getStatus(),
                    "Could not set log level. Error response: " + responseToString(response)
            );
        }
    }
Adjust the level of a logging namespace.
@param namespace the namespace to adjust; may not be null
@param level the level to set the namespace to; may not be null
@param scope the scope of the operation; may be null
@return the list of affected loggers, as reported by the Connect REST API;
may be null if no body was included in the response
connect/runtime/src/test/java/org/apache/kafka/connect/util/clusters/EmbeddedConnect.java