You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by GitBox <gi...@apache.org> on 2021/06/21 12:20:16 UTC

[GitHub] [sling-org-apache-sling-graphql-core] denismoret commented on a change in pull request #24: SLING-10503: upon error the schema definition in logged only if the DEBUG log level is enabled

denismoret commented on a change in pull request #24:
URL: https://github.com/apache/sling-org-apache-sling-graphql-core/pull/24#discussion_r655326840



##########
File path: src/main/java/org/apache/sling/graphql/core/engine/DefaultQueryExecutor.java
##########
@@ -219,16 +219,25 @@ public ValidationResult validate(@NotNull String query, @NotNull Map<String, Obj
                     }
                 }
                 if (LOGGER.isErrorEnabled()) {
-                    LOGGER.error("Query failed for Resource {}: query={} Errors:{}, schema={}",
-                            queryResource.getPath(), cleanLog.sanitize(query), errors, schemaDef);
+                    final String errorMessage = String.format("Query failed for Resource %s: query=%s Errors:%s",
+                            queryResource.getPath(), cleanLog.sanitize(query), errors);
+                    if (LOGGER.isDebugEnabled()) {
+                        LOGGER.error(String.format("%s, schema=%s", errorMessage, schemaDef));

Review comment:
       I did verify that the schema is logged but you're right the `schemaDef` variable is not set since this [commit](https://github.com/apache/sling-org-apache-sling-graphql-core/commit/9abddb77904a079a5c3c58de0901ac576fb6b53f#). The logs I had came for the previous version (0.0.9), my bad, but the code still needs to be fixed.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org