public boolean enableConsole() { boolean failures = false; if (console == null) { log.debug("Asked to enable console, but it was not configured"); return false; } for (ConsoleReporterConfig consoleConfig : console) { if (!consoleConfig.enable()) { failures = true; } } return !failures; }
@Override public boolean enable() { try { PrintStream stream = createPrintStream(); // static enable() methods omit the option of specifying a // predicate. Calling constructor and starting manually // instead final ConsoleReporter reporter = new ConsoleReporter( Metrics.defaultRegistry(), stream, MetricPredicateTransformer.generatePredicate(getPredicate())); reporter.start(getPeriod(), getRealTimeunit()); } catch (Exception e) { log.error("Failure while enabling console reporter", e); return false; } return true; }
@Override public boolean enable() { try { PrintStream stream = null; if (outfile != null) { log.info("console reporting will be redirected to {} instead of stdout", outfile); stream = new PrintStream(outfile); } else { stream = System.out; } // static enable() methods omit the option of specifying a // predicate. Calling constructor and starting manually // instead final ConsoleReporter reporter = new ConsoleReporter(Metrics.defaultRegistry(), stream, getMetricPredicate()); reporter.start(getPeriod(), getRealTimeunit()); } catch (Exception e) { log.error("Failure while enabling console reporter", e); return false; } return true; }
public boolean enableConsole() { boolean failures = false; if (console == null) { log.debug("Asked to enable console, but it was not configured"); return false; } for (ConsoleReporterConfig consoleConfig : console) { if (!consoleConfig.enable()) { failures = true; } } return !failures; }