@@ -477,7 +477,9 @@ public CompletableFuture<ExecutionResult> executeAsync(UnaryOperator<ExecutionIn
477477 */
478478 public CompletableFuture <ExecutionResult > executeAsync (ExecutionInput executionInput ) {
479479 try {
480- logNotSafe .debug ("Executing request. operation name: '{}'. query: '{}'. variables '{}'" , executionInput .getOperationName (), executionInput .getQuery (), executionInput .getVariables ());
480+ if (logNotSafe .isDebugEnabled ()) {
481+ logNotSafe .debug ("Executing request. operation name: '{}'. query: '{}'. variables '{}'" , executionInput .getOperationName (), executionInput .getQuery (), executionInput .getVariables ());
482+ }
481483 executionInput = ensureInputHasId (executionInput );
482484
483485 InstrumentationState instrumentationState = instrumentation .createState (new InstrumentationCreateStateParameters (this .graphQLSchema , executionInput ));
@@ -534,7 +536,9 @@ private PreparsedDocumentEntry parseAndValidate(AtomicReference<ExecutionInput>
534536 ExecutionInput executionInput = executionInputRef .get ();
535537 String query = executionInput .getQuery ();
536538
537- logNotSafe .debug ("Parsing query: '{}'..." , query );
539+ if (logNotSafe .isDebugEnabled ()) {
540+ logNotSafe .debug ("Parsing query: '{}'..." , query );
541+ }
538542 ParseAndValidateResult parseResult = parse (executionInput , graphQLSchema , instrumentationState );
539543 if (parseResult .isFailure ()) {
540544 logNotSafe .warn ("Query failed to parse : '{}'" , executionInput .getQuery ());
@@ -545,7 +549,9 @@ private PreparsedDocumentEntry parseAndValidate(AtomicReference<ExecutionInput>
545549 executionInput = executionInput .transform (builder -> builder .variables (parseResult .getVariables ()));
546550 executionInputRef .set (executionInput );
547551
548- logNotSafe .debug ("Validating query: '{}'" , query );
552+ if (logNotSafe .isDebugEnabled ()) {
553+ logNotSafe .debug ("Validating query: '{}'" , query );
554+ }
549555 final List <ValidationError > errors = validate (executionInput , document , graphQLSchema , instrumentationState );
550556 if (!errors .isEmpty ()) {
551557 logNotSafe .warn ("Query failed to validate : '{}'" , query );
@@ -594,17 +600,21 @@ private CompletableFuture<ExecutionResult> execute(ExecutionInput executionInput
594600 Execution execution = new Execution (queryStrategy , mutationStrategy , subscriptionStrategy , instrumentation , valueUnboxer );
595601 ExecutionId executionId = executionInput .getExecutionId ();
596602
597- logNotSafe .debug ("Executing '{}'. operation name: '{}'. query: '{}'. variables '{}'" , executionId , executionInput .getOperationName (), executionInput .getQuery (), executionInput .getVariables ());
603+ if (logNotSafe .isDebugEnabled ()) {
604+ logNotSafe .debug ("Executing '{}'. operation name: '{}'. query: '{}'. variables '{}'" , executionId , executionInput .getOperationName (), executionInput .getQuery (), executionInput .getVariables ());
605+ }
598606 CompletableFuture <ExecutionResult > future = execution .execute (document , graphQLSchema , executionId , executionInput , instrumentationState );
599607 future = future .whenComplete ((result , throwable ) -> {
600608 if (throwable != null ) {
601609 logNotSafe .error (String .format ("Execution '%s' threw exception when executing : query : '%s'. variables '%s'" , executionId , executionInput .getQuery (), executionInput .getVariables ()), throwable );
602610 } else {
603- int errorCount = result .getErrors ().size ();
604- if (errorCount > 0 ) {
605- log .debug ("Execution '{}' completed with '{}' errors" , executionId , errorCount );
606- } else {
607- log .debug ("Execution '{}' completed with zero errors" , executionId );
611+ if (log .isDebugEnabled ()) {
612+ int errorCount = result .getErrors ().size ();
613+ if (errorCount > 0 ) {
614+ log .debug ("Execution '{}' completed with '{}' errors" , executionId , errorCount );
615+ } else {
616+ log .debug ("Execution '{}' completed with zero errors" , executionId );
617+ }
608618 }
609619 }
610620 });
0 commit comments