@@ -434,16 +434,18 @@ synchronized void clear() {
434
434
extraQueryStats = new ExtraQueryStats (statsControl );
435
435
}
436
436
437
- // Setup the scheduler for interval logging
437
+ // Set up the scheduler for interval logging
438
438
Runnable runnable = () -> {
439
439
try {
440
440
logClientStats ();
441
441
} catch (RuntimeException re ) {
442
- StringWriter stackTrace = new StringWriter ();
443
- re .printStackTrace (new PrintWriter (stackTrace ));
444
- statsControl .getLogger ().log (Level .INFO ,
445
- "Stats exception: " + re .getMessage () + "\n " +
446
- stackTrace );
442
+ if (statsControl .getLogger () != null ) {
443
+ StringWriter stackTrace = new StringWriter ();
444
+ re .printStackTrace (new PrintWriter (stackTrace ));
445
+ statsControl .getLogger ().log (Level .INFO ,
446
+ "Stats exception: " + re .getMessage () + "\n " +
447
+ stackTrace );
448
+ }
447
449
}
448
450
};
449
451
@@ -482,10 +484,12 @@ private void logClientStats() {
482
484
}
483
485
484
486
// Output stats to logger.
485
- String json = fvStats .toJson (statsControl .getPrettyPrint () ?
486
- JsonOptions .PRETTY : null );
487
- statsControl .getLogger ().log (Level .INFO ,
488
- StatsControl .LOG_PREFIX + json );
487
+ if (statsControl .getLogger () != null ) {
488
+ String json = fvStats .toJson (statsControl .getPrettyPrint () ?
489
+ JsonOptions .PRETTY : null );
490
+ statsControl .getLogger ().log (Level .INFO ,
491
+ StatsControl .LOG_PREFIX + json );
492
+ }
489
493
}
490
494
491
495
private MapValue generateFieldValueStats () {
0 commit comments