diff --git a/graylog2-server/src/main/java/org/graylog2/lookup/LookupDataAdapterRefreshService.java b/graylog2-server/src/main/java/org/graylog2/lookup/LookupDataAdapterRefreshService.java index 9bea9211a1f4..bbc332136eb3 100644 --- a/graylog2-server/src/main/java/org/graylog2/lookup/LookupDataAdapterRefreshService.java +++ b/graylog2-server/src/main/java/org/graylog2/lookup/LookupDataAdapterRefreshService.java @@ -106,7 +106,7 @@ public void add(LookupDataAdapter dataAdapter) { // ConcurrentMap#computeIfAbsent() does not work here because scheduling a job is not idempotent. synchronized (futures) { if (!futures.containsKey(instanceId)) { - LOG.info("Adding job for <{}/{}/@{}> [interval={}ms]", dataAdapter.name(), dataAdapter.id(), instanceId, interval.getMillis()); + LOG.debug("Adding job for <{}/{}/@{}> [interval={}ms]", dataAdapter.name(), dataAdapter.id(), instanceId, interval.getMillis()); futures.put(instanceId, schedule(dataAdapter, interval)); } else { LOG.warn("Job for <{}/{}/@{}> already exists, not adding it again.", dataAdapter.name(), dataAdapter.id(), instanceId); @@ -128,7 +128,7 @@ public void remove(LookupDataAdapter dataAdapter) { // Using the adapter object ID here to make it possible to have multiple jobs for the same adapter final String instanceId = objectId(dataAdapter); if (futures.containsKey(instanceId)) { - LOG.info("Removing job for <{}/{}/@{}>", dataAdapter.name(), dataAdapter.id(), instanceId); + LOG.debug("Removing job for <{}/{}/@{}>", dataAdapter.name(), dataAdapter.id(), instanceId); } // Try to cancel the job even if the check above fails to avoid race conditions cancel(futures.remove(instanceId)); diff --git a/graylog2-server/src/main/java/org/graylog2/lookup/LookupTableService.java b/graylog2-server/src/main/java/org/graylog2/lookup/LookupTableService.java index 8d49fff5b375..45d887df230e 100644 --- a/graylog2-server/src/main/java/org/graylog2/lookup/LookupTableService.java +++ b/graylog2-server/src/main/java/org/graylog2/lookup/LookupTableService.java @@ -418,12 +418,13 @@ protected LookupDataAdapter createAdapter(DataAdapterDto dto) { } protected void addListeners(LookupDataAdapter adapter, DataAdapterDto dto) { - - adapter.addListener(new LoggingServiceListener( - "Data Adapter", - String.format(Locale.ENGLISH, "%s/%s [@%s]", dto.name(), dto.id(), objectId(adapter)), - LOG), - scheduler); + if (LOG.isDebugEnabled()) { + adapter.addListener(new LoggingServiceListener( + "Data Adapter", + String.format(Locale.ENGLISH, "%s/%s [@%s]", dto.name(), dto.id(), objectId(adapter)), + LOG), + scheduler); + } // Each adapter needs to be added to the refresh scheduler adapter.addListener(adapterRefreshService.newServiceListener(adapter), scheduler); } @@ -455,11 +456,13 @@ private LookupCache createCache(CacheDto dto) { return null; } final LookupCache cache = factory.create(dto.id(), dto.name(), dto.config()); - cache.addListener(new LoggingServiceListener( - "Cache", - String.format(Locale.ENGLISH, "%s/%s [@%s]", dto.name(), dto.id(), objectId(cache)), - LOG), - scheduler); + if (LOG.isDebugEnabled()) { + cache.addListener(new LoggingServiceListener( + "Cache", + String.format(Locale.ENGLISH, "%s/%s [@%s]", dto.name(), dto.id(), objectId(cache)), + LOG), + scheduler); + } return cache; } catch (Exception e) { LOG.error("Couldn't create cache <{}/{}>", dto.name(), dto.id(), e); @@ -522,13 +525,13 @@ private LookupTable createLookupTable(LookupTableDto dto) { .build(); final LookupCache newCache = table.cache(); final LookupDataAdapter newAdapter = table.dataAdapter(); - LOG.info("Starting lookup table {}/{} [@{}] using cache {}/{} [@{}], data adapter {}/{} [@{}]", + LOG.debug("Starting lookup table {}/{} [@{}] using cache {}/{} [@{}], data adapter {}/{} [@{}]", table.name(), table.id(), objectId(table), newCache.name(), newCache.id(), objectId(newCache), newAdapter.name(), newAdapter.id(), objectId(newAdapter)); final LookupTable previous = liveTables.put(dto.name(), table); if (previous != null) { - LOG.info("Replaced previous lookup table {} [@{}]", previous.name(), objectId(previous)); + LOG.debug("Replaced previous lookup table {} [@{}]", previous.name(), objectId(previous)); } return table; } diff --git a/graylog2-server/src/main/java/org/graylog2/periodical/Periodicals.java b/graylog2-server/src/main/java/org/graylog2/periodical/Periodicals.java index b74e4fead357..1c4cb1e12da6 100644 --- a/graylog2-server/src/main/java/org/graylog2/periodical/Periodicals.java +++ b/graylog2-server/src/main/java/org/graylog2/periodical/Periodicals.java @@ -62,7 +62,7 @@ public synchronized void registerAndStart(Periodical periodical) { t.start(); } } else { - LOG.info( + LOG.debug( "Starting [{}] periodical in [{}s], polling every [{}s].", periodical.getClass().getCanonicalName(), periodical.getInitialDelaySeconds(), diff --git a/graylog2-server/src/main/java/org/graylog2/shared/initializers/PeriodicalsService.java b/graylog2-server/src/main/java/org/graylog2/shared/initializers/PeriodicalsService.java index db94aa4e4d48..45f5aa21bd1c 100644 --- a/graylog2-server/src/main/java/org/graylog2/shared/initializers/PeriodicalsService.java +++ b/graylog2-server/src/main/java/org/graylog2/shared/initializers/PeriodicalsService.java @@ -100,21 +100,27 @@ private synchronized void startPeriodicals(Set periodicalsToStart) { LOG.warn("Skipping start of {} periodicals which have already been started.", numOfPeriodicalsToSkip); } + int successes = 0; + int failures = 0; for (Periodical periodical : notYetStartedPeriodicals) { try { periodical.initialize(); if (!periodical.startOnThisNode()) { - LOG.info("Not starting [{}] periodical. Not configured to run on this node.", periodical.getClass().getCanonicalName()); + LOG.debug("Not starting [{}] periodical. Not configured to run on this node.", periodical.getClass().getCanonicalName()); + successes++; continue; } // Register and start. periodicals.registerAndStart(periodical); + successes++; } catch (Exception e) { LOG.error("Could not initialize periodical.", e); + failures++; } } + LOG.info("Started [{}/{}] periodicals successfully, {} failed.", successes, notYetStartedPeriodicals.size(), failures); } private synchronized void stopPeriodicals(Collection periodicalsToStop) {