diff --git a/CHANGES.md b/CHANGES.md index b18e81b3e..2dbdcc303 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,8 +1,9 @@ # Changes ## Version 5.0.5 +* Define logging levels formally - Issue #666 * Deprecate cassandra-all to use testContainers instead - Issue #701 -* Updata Mockito and JUnit versions - Issue #687 +* Update Mockito and JUnit versions - Issue #687 * Metric status logger for troubleshooting - Issue #397 ## Version 5.0.4 diff --git a/application/src/main/java/com/ericsson/bss/cassandra/ecchronos/application/DefaultJmxConnectionProvider.java b/application/src/main/java/com/ericsson/bss/cassandra/ecchronos/application/DefaultJmxConnectionProvider.java index 5be5a35bd..1ca7f3c6e 100644 --- a/application/src/main/java/com/ericsson/bss/cassandra/ecchronos/application/DefaultJmxConnectionProvider.java +++ b/application/src/main/java/com/ericsson/bss/cassandra/ecchronos/application/DefaultJmxConnectionProvider.java @@ -46,7 +46,10 @@ public DefaultJmxConnectionProvider(final Config config, int port = jmxConfig.getPort(); boolean authEnabled = jmxSecurity.get().getJmxCredentials().isEnabled(); boolean tlsEnabled = jmxSecurity.get().getJmxTlsConfig().isEnabled(); - LOG.info("Connecting through JMX using {}:{}, authentication: {}, tls: {}", host, port, authEnabled, + LOG.info("Connecting through JMX using {}:{}, authentication: {}, tls: {}", + host, + port, + authEnabled, tlsEnabled); Supplier credentials = () -> convertCredentials(jmxSecurity); diff --git a/application/src/main/java/com/ericsson/bss/cassandra/ecchronos/application/DefaultNativeConnectionProvider.java b/application/src/main/java/com/ericsson/bss/cassandra/ecchronos/application/DefaultNativeConnectionProvider.java index aa47bb1ee..6285f0faa 100644 --- a/application/src/main/java/com/ericsson/bss/cassandra/ecchronos/application/DefaultNativeConnectionProvider.java +++ b/application/src/main/java/com/ericsson/bss/cassandra/ecchronos/application/DefaultNativeConnectionProvider.java @@ -55,7 +55,10 @@ public DefaultNativeConnectionProvider(final Config config, Security.CqlSecurity cqlSecurity = cqlSecuritySupplier.get(); boolean authEnabled = cqlSecurity.getCqlCredentials().isEnabled(); boolean tlsEnabled = cqlSecurity.getCqlTlsConfig().isEnabled(); - LOG.info("Connecting through CQL using {}:{}, authentication: {}, tls: {}", host, port, authEnabled, + LOG.info("Connecting through CQL using {}:{}, authentication: {}, tls: {}", + host, + port, + authEnabled, tlsEnabled); AuthProvider authProvider = null; if (authEnabled) @@ -151,11 +154,11 @@ private static void handleRetry( { Thread.sleep(delay); } - catch (InterruptedException e1) + catch (InterruptedException ie) { LOG.error( "InterruptedException caught during the delay time, while trying to reconnect to Cassandra. Reason: ", - e1); + ie); } } diff --git a/application/src/main/java/com/ericsson/bss/cassandra/ecchronos/application/ECChronosInternals.java b/application/src/main/java/com/ericsson/bss/cassandra/ecchronos/application/ECChronosInternals.java index 7aacb222c..a4c48917e 100644 --- a/application/src/main/java/com/ericsson/bss/cassandra/ecchronos/application/ECChronosInternals.java +++ b/application/src/main/java/com/ericsson/bss/cassandra/ecchronos/application/ECChronosInternals.java @@ -221,7 +221,9 @@ public void repairState(final TableReference tableReference, final int repairedRanges, final int notRepairedRanges) { - LOG.trace("Updated repair state of {}, {}/{} repaired ranges", tableReference, repairedRanges, + LOG.trace("Updated repair state of {}, {}/{} repaired ranges", + tableReference, + repairedRanges, notRepairedRanges); } @@ -243,11 +245,10 @@ public void repairSession(final TableReference tableReference, final TimeUnit timeUnit, final boolean successful) { - if (LOG.isTraceEnabled()) - { - LOG.trace("Repair timing for table {} {}ms, it was {}", tableReference, - timeUnit.toMillis(timeTaken), successful ? "successful" : "not successful"); - } + LOG.trace("Repair timing for table {} {}ms, it was {}successful", + tableReference, + timeUnit.toMillis(timeTaken), + successful ? "" : "not "); } } diff --git a/application/src/main/java/com/ericsson/bss/cassandra/ecchronos/application/ReloadingCertificateHandler.java b/application/src/main/java/com/ericsson/bss/cassandra/ecchronos/application/ReloadingCertificateHandler.java index fd8adf27e..a13e18f50 100644 --- a/application/src/main/java/com/ericsson/bss/cassandra/ecchronos/application/ReloadingCertificateHandler.java +++ b/application/src/main/java/com/ericsson/bss/cassandra/ecchronos/application/ReloadingCertificateHandler.java @@ -117,8 +117,13 @@ protected final Context getContext() tlsConfig = myCqlTLSConfigSupplier.get(); } } - catch (NoSuchAlgorithmException | IOException | UnrecoverableKeyException | CertificateException - | KeyStoreException | KeyManagementException e) + catch (NoSuchAlgorithmException + | IOException + | UnrecoverableKeyException + | CertificateException + | KeyStoreException + | KeyManagementException + e) { LOG.warn("Unable to create new SSL Context after configuration changed. Trying with the old one", e); } diff --git a/application/src/main/java/com/ericsson/bss/cassandra/ecchronos/application/YamlToMarkdownConverter.java b/application/src/main/java/com/ericsson/bss/cassandra/ecchronos/application/YamlToMarkdownConverter.java index e02404b69..a1577676c 100644 --- a/application/src/main/java/com/ericsson/bss/cassandra/ecchronos/application/YamlToMarkdownConverter.java +++ b/application/src/main/java/com/ericsson/bss/cassandra/ecchronos/application/YamlToMarkdownConverter.java @@ -53,7 +53,7 @@ public static void main(final String[] args) } catch (IOException e) { - LOG.error("Error converting Ecc YAML file to markdown file", e); + LOG.error("Error converting ecc YAML file to markdown file", e); } } diff --git a/application/src/main/java/com/ericsson/bss/cassandra/ecchronos/application/config/repair/RepairConfig.java b/application/src/main/java/com/ericsson/bss/cassandra/ecchronos/application/config/repair/RepairConfig.java index e0b333623..2958fead0 100644 --- a/application/src/main/java/com/ericsson/bss/cassandra/ecchronos/application/config/repair/RepairConfig.java +++ b/application/src/main/java/com/ericsson/bss/cassandra/ecchronos/application/config/repair/RepairConfig.java @@ -153,7 +153,10 @@ public final void validate(final String repairConfigType) if (repairIntervalSeconds < initialDelaySeconds) { LOG.warn("{} repair interval ({}s) is shorter than initial delay ({}s). Will use {}s as initial delay.", - repairConfigType, repairIntervalSeconds, initialDelaySeconds, repairIntervalSeconds); + repairConfigType, + repairIntervalSeconds, + initialDelaySeconds, + repairIntervalSeconds); myInitialDelay = new Interval(myRepairInterval.getTime(), myRepairInterval.getUnit()); } diff --git a/application/src/main/java/com/ericsson/bss/cassandra/ecchronos/application/spring/CassandraHealthIndicator.java b/application/src/main/java/com/ericsson/bss/cassandra/ecchronos/application/spring/CassandraHealthIndicator.java index e8f8c8d7f..600259ebc 100644 --- a/application/src/main/java/com/ericsson/bss/cassandra/ecchronos/application/spring/CassandraHealthIndicator.java +++ b/application/src/main/java/com/ericsson/bss/cassandra/ecchronos/application/spring/CassandraHealthIndicator.java @@ -72,7 +72,7 @@ private boolean isJmxConnectionUp(final Map details) } catch (Exception e) { - LOG.debug("Unable to connect over JMX", e); + LOG.error("Unable to connect over JMX", e); details.put("JMX connection error:", e.getMessage()); } return false; @@ -92,7 +92,7 @@ private boolean isCqlConnectionUp(final Map details) } catch (Exception e) { - LOG.debug("Unable to connect over CQL", e); + LOG.error("Unable to connect over CQL", e); details.put("CQL connection error:", e.getMessage()); } return false; diff --git a/connection.impl/src/main/java/com/ericsson/bss/cassandra/ecchronos/connection/impl/LocalJmxConnectionProvider.java b/connection.impl/src/main/java/com/ericsson/bss/cassandra/ecchronos/connection/impl/LocalJmxConnectionProvider.java index 9bb52e551..63ad4ba81 100644 --- a/connection.impl/src/main/java/com/ericsson/bss/cassandra/ecchronos/connection/impl/LocalJmxConnectionProvider.java +++ b/connection.impl/src/main/java/com/ericsson/bss/cassandra/ecchronos/connection/impl/LocalJmxConnectionProvider.java @@ -123,9 +123,8 @@ private void reconnect() throws IOException boolean authEnabled = credentials != null; boolean tlsEnabled = !tls.isEmpty(); - LOG.debug("Connecting JMX through {}, credentials: {}, tls: {}", jmxUrl, authEnabled, tlsEnabled); JMXConnector jmxConnector = JMXConnectorFactory.connect(jmxUrl, env); - LOG.debug("Connected JMX for {}", jmxUrl); + LOG.debug("Connected JMX for {}, credentials: {}, tls: {}", jmxUrl, authEnabled, tlsEnabled); switchJmxConnection(jmxConnector); } diff --git a/connection.impl/src/main/java/com/ericsson/bss/cassandra/ecchronos/connection/impl/LocalNativeConnectionProvider.java b/connection.impl/src/main/java/com/ericsson/bss/cassandra/ecchronos/connection/impl/LocalNativeConnectionProvider.java index c9ac49a3b..077161f37 100644 --- a/connection.impl/src/main/java/com/ericsson/bss/cassandra/ecchronos/connection/impl/LocalNativeConnectionProvider.java +++ b/connection.impl/src/main/java/com/ericsson/bss/cassandra/ecchronos/connection/impl/LocalNativeConnectionProvider.java @@ -195,7 +195,9 @@ private static CqlSession createSession(final Builder builder) InitialContact initialContact = resolveInitialContact(contactEndPoint, builder); - LOG.debug("Connecting to {}({}), local data center: {}", contactEndPoint, initialContact.getHostId(), + LOG.debug("Connecting to {} ({}), local data center: {}", + contactEndPoint, + initialContact.getHostId(), initialContact.getDataCenter()); CqlSessionBuilder sessionBuilder = fromBuilder(builder); diff --git a/core.osgi/src/main/java/com/ericsson/bss/cassandra/ecchronos/core/osgi/RepairHistoryService.java b/core.osgi/src/main/java/com/ericsson/bss/cassandra/ecchronos/core/osgi/RepairHistoryService.java index e6ccc8f4c..749d4f7cb 100644 --- a/core.osgi/src/main/java/com/ericsson/bss/cassandra/ecchronos/core/osgi/RepairHistoryService.java +++ b/core.osgi/src/main/java/com/ericsson/bss/cassandra/ecchronos/core/osgi/RepairHistoryService.java @@ -91,8 +91,9 @@ public final void activate(final Configuration configuration) Optional localNode = nodeResolver.fromUUID(node.getHostId()); if (!localNode.isPresent()) { - LOG.error("Local node ({}) not found in resolver", node.getHostId()); - throw new IllegalStateException("Local node (" + node.getHostId() + ") not found in resolver"); + String msg = String.format("Local node (%s) not found in resolver", node.getHostId()); + LOG.error(msg); + throw new IllegalStateException(msg); } long lookbackTimeInMillis = configuration.lookbackTimeSeconds() * ONE_SECOND_MILLIS; diff --git a/core/src/main/java/com/ericsson/bss/cassandra/ecchronos/core/CASLock.java b/core/src/main/java/com/ericsson/bss/cassandra/ecchronos/core/CASLock.java index 8eaba3b09..d318f2fc7 100644 --- a/core/src/main/java/com/ericsson/bss/cassandra/ecchronos/core/CASLock.java +++ b/core/src/main/java/com/ericsson/bss/cassandra/ecchronos/core/CASLock.java @@ -148,7 +148,8 @@ public void close() else { LOG.debug("Locally highest priority ({}) is higher than current ({}), will not remove", - myLocallyHighestPriority, myPriority); + myLocallyHighestPriority, + myPriority); } } } diff --git a/core/src/main/java/com/ericsson/bss/cassandra/ecchronos/core/CASLockFactory.java b/core/src/main/java/com/ericsson/bss/cassandra/ecchronos/core/CASLockFactory.java index 69a3aaa4b..3e09ddb07 100644 --- a/core/src/main/java/com/ericsson/bss/cassandra/ecchronos/core/CASLockFactory.java +++ b/core/src/main/java/com/ericsson/bss/cassandra/ecchronos/core/CASLockFactory.java @@ -311,33 +311,33 @@ private int liveNodes(final Collection nodes) private void verifySchemasExists() { Optional keyspaceMetadata = myCasLockProperties - .getSession().getMetadata() + .getSession().getMetadata() .getKeyspace(myCasLockProperties.getKeyspaceName()); + if (!keyspaceMetadata.isPresent()) { - LOG.error("Keyspace {} does not exist, it needs to be created", - myCasLockProperties.getKeyspaceName()); - throw new IllegalStateException( - String.format("Keyspace %s does not exist, it needs to be created", - myCasLockProperties.getKeyspaceName())); + String msg = String.format("Keyspace %s does not exist, it needs to be created", + myCasLockProperties.getKeyspaceName()); + LOG.error(msg); + throw new IllegalStateException(msg); } if (!keyspaceMetadata.get().getTable(TABLE_LOCK).isPresent()) { - LOG.error("Table {}.{} does not exist, it needs to be created", - myCasLockProperties.getKeyspaceName(), TABLE_LOCK); - throw new IllegalStateException( - String.format("Table %s.%s does not exist, it needs to be created", - myCasLockProperties.getKeyspaceName(), TABLE_LOCK)); + String msg = String.format("Table %s.%s does not exist, it needs to be created", + myCasLockProperties.getKeyspaceName(), + TABLE_LOCK); + LOG.error(msg); + throw new IllegalStateException(msg); } if (!keyspaceMetadata.get().getTable(TABLE_LOCK_PRIORITY).isPresent()) { - LOG.error("Table {}.{} does not exist, it needs to be created", - myCasLockProperties.getKeyspaceName(), TABLE_LOCK_PRIORITY); - throw new IllegalStateException( - String.format("Table %s.%s does not exist, it needs to be created", - myCasLockProperties.getKeyspaceName(), TABLE_LOCK_PRIORITY)); + String msg = String.format("Table %s.%s does not exist, it needs to be created", + myCasLockProperties.getKeyspaceName(), + TABLE_LOCK_PRIORITY); + LOG.error(msg); + throw new IllegalStateException(msg); } } diff --git a/core/src/main/java/com/ericsson/bss/cassandra/ecchronos/core/CassandraMetrics.java b/core/src/main/java/com/ericsson/bss/cassandra/ecchronos/core/CassandraMetrics.java index e92916d7b..e93e0060d 100644 --- a/core/src/main/java/com/ericsson/bss/cassandra/ecchronos/core/CassandraMetrics.java +++ b/core/src/main/java/com/ericsson/bss/cassandra/ecchronos/core/CassandraMetrics.java @@ -70,7 +70,8 @@ private CassandraMetric getMetrics(final TableReference tableReference) throws I } catch (IOException e) { - THROTTLED_LOGGER.warn("Unable to fetch metrics from Cassandra, future metrics might contain stale values", + THROTTLED_LOGGER.warn( + "Unable to fetch metrics from Cassandra, future metrics might contain stale values", e); throw e; } diff --git a/core/src/main/java/com/ericsson/bss/cassandra/ecchronos/core/HostStatesImpl.java b/core/src/main/java/com/ericsson/bss/cassandra/ecchronos/core/HostStatesImpl.java index 2d1f9c69e..1197f9fe0 100644 --- a/core/src/main/java/com/ericsson/bss/cassandra/ecchronos/core/HostStatesImpl.java +++ b/core/src/main/java/com/ericsson/bss/cassandra/ecchronos/core/HostStatesImpl.java @@ -119,7 +119,7 @@ private synchronized boolean tryRefreshHostStates() if (changeHostState(host, true)) { - LOG.debug("Host {} marked as up", host); + LOG.debug("Host {} marked as UP", host); } } @@ -129,7 +129,7 @@ private synchronized boolean tryRefreshHostStates() if (changeHostState(host, false)) { - LOG.debug("Host {} marked as down", host); + LOG.debug("Host {} marked as DOWN", host); } } diff --git a/core/src/main/java/com/ericsson/bss/cassandra/ecchronos/core/JmxProxyFactoryImpl.java b/core/src/main/java/com/ericsson/bss/cassandra/ecchronos/core/JmxProxyFactoryImpl.java index d8a137bfc..c9509480e 100644 --- a/core/src/main/java/com/ericsson/bss/cassandra/ecchronos/core/JmxProxyFactoryImpl.java +++ b/core/src/main/java/com/ericsson/bss/cassandra/ecchronos/core/JmxProxyFactoryImpl.java @@ -193,7 +193,10 @@ public void forceTerminateAllRepairSessions() FORCE_TERMINATE_ALL_REPAIR_SESSIONS_METHOD, null, null); } - catch (InstanceNotFoundException | MBeanException | ReflectionException | IOException e) + catch (InstanceNotFoundException + | MBeanException + | ReflectionException + | IOException e) { LOG.error("Unable to terminate repair sessions"); } @@ -214,7 +217,9 @@ public void removeStorageServiceListener(final NotificationListener listener) myJmxConnector.removeConnectionNotificationListener(listener); myMbeanServerConnection.removeNotificationListener(myStorageServiceObject, listener); } - catch (InstanceNotFoundException | ListenerNotFoundException | IOException e) + catch (InstanceNotFoundException + | ListenerNotFoundException + | IOException e) { LOG.error("Unable to remove StorageService listener", e); } @@ -232,8 +237,7 @@ public long liveDiskSpaceUsed(final TableReference tableReference) { try { - ObjectName objectName - = new ObjectName(String + ObjectName objectName = new ObjectName(String .format("org.apache.cassandra.metrics:type=Table,keyspace=%s,scope=%s,name=LiveDiskSpaceUsed", tableReference.getKeyspace(), tableReference.getTable())); @@ -277,7 +281,10 @@ public long getMaxRepairedAt(final TableReference tableReference) return maxRepaired; } } - catch (InstanceNotFoundException | MBeanException | ReflectionException | IOException e) + catch (InstanceNotFoundException + | MBeanException + | ReflectionException + | IOException e) { LOG.error("Unable to get maxRepaired for {}", tableReference, e); } @@ -289,8 +296,7 @@ public double getPercentRepaired(final TableReference tableReference) { try { - ObjectName objectName - = new ObjectName(String + ObjectName objectName = new ObjectName(String .format("org.apache.cassandra.metrics:type=Table,keyspace=%s,scope=%s,name=PercentRepaired", tableReference.getKeyspace(), tableReference.getTable())); @@ -317,10 +323,10 @@ public String getNodeStatus() return (String) myMbeanServerConnection.getAttribute(myStorageServiceObject, "OperationMode"); } catch (InstanceNotFoundException - | AttributeNotFoundException - | MBeanException - | ReflectionException - | IOException e) + | AttributeNotFoundException + | MBeanException + | ReflectionException + | IOException e) { LOG.error("Unable to retrieve node status {}", e.getMessage()); return "Unknown"; diff --git a/core/src/main/java/com/ericsson/bss/cassandra/ecchronos/core/LockCollection.java b/core/src/main/java/com/ericsson/bss/cassandra/ecchronos/core/LockCollection.java index a0f3efe59..4784a767d 100644 --- a/core/src/main/java/com/ericsson/bss/cassandra/ecchronos/core/LockCollection.java +++ b/core/src/main/java/com/ericsson/bss/cassandra/ecchronos/core/LockCollection.java @@ -52,7 +52,7 @@ public void close() } catch (Exception e) { - LOG.warn("Unable to release lock {} ", lock, e); + LOG.warn("Unable to release lock {}", lock, e); } } } diff --git a/core/src/main/java/com/ericsson/bss/cassandra/ecchronos/core/TimeBasedRunPolicy.java b/core/src/main/java/com/ericsson/bss/cassandra/ecchronos/core/TimeBasedRunPolicy.java index 96dc1f060..2bac32eac 100644 --- a/core/src/main/java/com/ericsson/bss/cassandra/ecchronos/core/TimeBasedRunPolicy.java +++ b/core/src/main/java/com/ericsson/bss/cassandra/ecchronos/core/TimeBasedRunPolicy.java @@ -203,17 +203,18 @@ private void verifySchemasExists() Optional keyspaceMetadata = mySession.getMetadata().getKeyspace(myKeyspaceName); if (!keyspaceMetadata.isPresent()) { - LOG.error("Keyspace {} does not exist, it needs to be created", myKeyspaceName); - throw new IllegalStateException("Keyspace " + myKeyspaceName - + " does not exist, it needs to be created"); + String msg = String.format("Keyspace %s does not exist, it needs to be created", myKeyspaceName); + LOG.error(msg); + throw new IllegalStateException(msg); } if (!keyspaceMetadata.get().getTable(TABLE_REJECT_CONFIGURATION).isPresent()) { - LOG.error("Table {}.{} does not exist, it needs to be created", - myKeyspaceName, TABLE_REJECT_CONFIGURATION); - throw new IllegalStateException("Table " + myKeyspaceName + "." - + TABLE_REJECT_CONFIGURATION + " does not exist, it needs to be created"); + String msg = String.format("Table %s.%s does not exist, it needs to be created", + myKeyspaceName, + TABLE_REJECT_CONFIGURATION); + LOG.error(msg); + throw new IllegalStateException(msg); } } } @@ -338,7 +339,7 @@ private long getRejectionsForTable(final TableReference tableReference) } catch (Exception e) { - LOG.error("Unable to parse/fetch rejection time for {}", tableReference, e); + LOG.warn("Unable to parse/fetch rejection time for {}", tableReference, e); rejectTime = DEFAULT_REJECT_TIME; } diff --git a/core/src/main/java/com/ericsson/bss/cassandra/ecchronos/core/repair/IncrementalOnDemandRepairJob.java b/core/src/main/java/com/ericsson/bss/cassandra/ecchronos/core/repair/IncrementalOnDemandRepairJob.java index 47c6bf052..87fbc2349 100644 --- a/core/src/main/java/com/ericsson/bss/cassandra/ecchronos/core/repair/IncrementalOnDemandRepairJob.java +++ b/core/src/main/java/com/ericsson/bss/cassandra/ecchronos/core/repair/IncrementalOnDemandRepairJob.java @@ -115,12 +115,12 @@ public void finishJob() if (myTasks.isEmpty()) { getOngoingJob().finishJob(); - LOG.info("Completed Incremental On Demand Repair: {}", id); + LOG.info("Completed incremental on demand repair: {}", id); } if (hasFailed()) { getOngoingJob().failJob(); - LOG.error("Failed Incremental On Demand Repair: {}", id); + LOG.error("Failed incremental on demand repair: {}", id); } super.finishJob(); } diff --git a/core/src/main/java/com/ericsson/bss/cassandra/ecchronos/core/repair/OnDemandRepairSchedulerImpl.java b/core/src/main/java/com/ericsson/bss/cassandra/ecchronos/core/repair/OnDemandRepairSchedulerImpl.java index 640260d71..62dc72ece 100644 --- a/core/src/main/java/com/ericsson/bss/cassandra/ecchronos/core/repair/OnDemandRepairSchedulerImpl.java +++ b/core/src/main/java/com/ericsson/bss/cassandra/ecchronos/core/repair/OnDemandRepairSchedulerImpl.java @@ -88,7 +88,8 @@ private void getOngoingJobs() } catch (Exception e) { - LOG.info("Failed to get ongoing ondemand jobs: {}, automatic retry in {}s", e.getMessage(), + LOG.warn("Failed to get ongoing on demand jobs: {}, automatic retry in {}s", + e.getMessage(), ONGOING_JOBS_PERIOD_SECONDS); } } diff --git a/core/src/main/java/com/ericsson/bss/cassandra/ecchronos/core/repair/OnDemandStatus.java b/core/src/main/java/com/ericsson/bss/cassandra/ecchronos/core/repair/OnDemandStatus.java index b55bbb4cb..7a26dfdeb 100644 --- a/core/src/main/java/com/ericsson/bss/cassandra/ecchronos/core/repair/OnDemandStatus.java +++ b/core/src/main/java/com/ericsson/bss/cassandra/ecchronos/core/repair/OnDemandStatus.java @@ -230,7 +230,8 @@ private Set getAllJobsForHost(final ReplicationState replicationStat catch (IllegalArgumentException e) { LOG.warn("Ignoring table repair job with id {} and hostId {}, unable to parse status", - row.getUuid(JOB_ID_COLUMN_NAME), hostId); + row.getUuid(JOB_ID_COLUMN_NAME), + hostId); continue; } @@ -280,8 +281,12 @@ private void createOngoingJob(final ReplicationState replicationState, } else { - LOG.info("Ignoring table repair job with id {} of table {} as it was for table {}.{}({})", jobId, - tableReference, keyspace, table, uDTTableReference.getUuid(UDT_ID_NAME)); + LOG.info("Ignoring table repair job with id {} of table {} as it was for table {}.{}({})", + jobId, + tableReference, + keyspace, + table, + uDTTableReference.getUuid(UDT_ID_NAME)); } } diff --git a/core/src/main/java/com/ericsson/bss/cassandra/ecchronos/core/repair/RepairGroup.java b/core/src/main/java/com/ericsson/bss/cassandra/ecchronos/core/repair/RepairGroup.java index 2667ee3f0..6af89d43f 100644 --- a/core/src/main/java/com/ericsson/bss/cassandra/ecchronos/core/repair/RepairGroup.java +++ b/core/src/main/java/com/ericsson/bss/cassandra/ecchronos/core/repair/RepairGroup.java @@ -124,7 +124,7 @@ public boolean execute() successful = false; if (e.getCause() instanceof InterruptedException) { - LOG.info("{} thread was interrupted", this); + LOG.warn("{} thread was interrupted", this); break; } } diff --git a/core/src/main/java/com/ericsson/bss/cassandra/ecchronos/core/repair/RepairLockFactoryImpl.java b/core/src/main/java/com/ericsson/bss/cassandra/ecchronos/core/repair/RepairLockFactoryImpl.java index 4fcc908f8..65f7e82c6 100644 --- a/core/src/main/java/com/ericsson/bss/cassandra/ecchronos/core/repair/RepairLockFactoryImpl.java +++ b/core/src/main/java/com/ericsson/bss/cassandra/ecchronos/core/repair/RepairLockFactoryImpl.java @@ -78,7 +78,7 @@ private void validateNoCachedFailures(final LockFactory lockFactory, final Set subRanges) if (subRangeSize.compareTo(totalRangeSize) != 0) { BigInteger difference = totalRangeSize.subtract(subRangeSize).abs(); - String message = String.format( - "Unexpected sub-range generation for %s. Difference of %s. Sub-ranges generated: %s", - tokenRange, difference, subRanges); - - LOG.error(message); - throw new InternalException(message); + String msg = String.format( + "Unexpected sub-range generation for %s. Difference: %s. Sub-ranges generated: %s", + tokenRange, + difference, + subRanges); + + LOG.error(msg); + throw new InternalException(msg); } } diff --git a/docs/CONTRIBUTING.md b/docs/CONTRIBUTING.md index 026d0af45..bcc390b88 100644 --- a/docs/CONTRIBUTING.md +++ b/docs/CONTRIBUTING.md @@ -24,9 +24,35 @@ New features should, in general, be added to the master branch. This project uses the cassandra code style which is based on Sun’s Java coding conventions. Formatting rules for eclipse can be found [here](../code_style.xml). -Provided patches should be contained and should not modify code outside of the scope of the patch. +Provided patches should be contained and should not modify code outside the scope of the patch. This will make it quicker to perform reviews and merging the pull requests. +### Logging + +The table below describe the main criteria(s) for each debugging level. The levels are in the order of (from most to least): +
+
+  all > trace > debug > info > warn > error > off
+
+ +| Log level | Description | +|----------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| all | All levels will be logged
Example: - | +| trace | Detailed debugging (flows, request/response, details, etc). Will have a performance impact and is therefore not for production, unless it is a planned troubleshooting activity. Mainly used during development.
Example: Every method call is logged in detail for a certain request and response flow. Used data is logged in detail. | +| debug | Simple debug logging which can be turned on and used in production if necessary (should have no impact on performance). The logs at this level should be of the type a developer might need to spot a quick fix to a problem or to at least isolate the problem further.
Example: Specific events with contextual details. | +| info | For logging the normal flow and operation of the service(s).
Example: Service health, progress of requests/responses etc. | +| warn | Behaviors in the service(s) which are unexpected and potentially could lead to errors, but were handled for the moment. However, the service(s) as such are still working normally and as expected.
Example: A primary service switching to a secondary one, connection retries, reverting to defaults etc. | +| error | A service or dependency have failed in the sense no requests can be served and/or data processed cannot be trusted.
Example: Connection attempts that ultimate fail. Crucial resources not available. | +| off | No levels will be logged at all.
Example: - | | + +If the log message may require lengthy calculations, method calls to collect data or concatenations, use an is...Enabled block to guard it. An example would be: +
+  if (LOG.isDebugEnabled())
+  {
+    LOG.debug("Environment status: {}", getSyncEnvironmentStatus());
+  }
+
+ ### Builds The builds required to merge a pull request are contained within the [Github configuration](../.github/workflows/actions.yml) and include tests, code coverage as well as PMD checks. diff --git a/docs/TROUBLESHOOTING.md b/docs/TROUBLESHOOTING.md index e497884bb..487493af4 100644 --- a/docs/TROUBLESHOOTING.md +++ b/docs/TROUBLESHOOTING.md @@ -9,7 +9,7 @@ The first step to troubleshooting an ecChronos issue is to use error messages, m ## Client Logs and Errors -During repair operations in a cassandra instance, triggered by ecChronos, it can return erros logs, like below: +During repair operations in a cassandra instance, triggered by ecChronos, it can return error logs, like below: |Error | Possible cause | |------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------| @@ -19,6 +19,19 @@ During repair operations in a cassandra instance, triggered by ecChronos, it can *Furthermore, one common problem is when repair is taking too much time or is overdue. This can be caused by too many vnodes, nodes going down while holding a lock and Cassandra nodes being down.* +## Logging + +By default the configured logging level is set to INFO. If needed though, DEBUG can be set by configuring it in [logback.xml](../ecchronos-binary/src/resources/logback.xml). + +Change the level to the following (and then restart ecChronos): + +``` + + + + +``` + ## Metrics If you have Cassandra metrics reporting to a centralized location such as Graphite or Grafana you can typically use those to narrow down the problem. Also, ecChronos can be monitored, as described in the [repair monitoring documentation](REPAIR_MONITORING.md). Using metrics, it is possible to identify problems in the cluster and evaluate some basic things, like overload, network issues, cassandra rejections, etc. diff --git a/ecchronos-binary/src/resources/logback.xml b/ecchronos-binary/src/resources/logback.xml index a74886964..b1807d2fb 100644 --- a/ecchronos-binary/src/resources/logback.xml +++ b/ecchronos-binary/src/resources/logback.xml @@ -16,6 +16,7 @@ --> + ecc.debug.log @@ -24,7 +25,9 @@ 10MB 1GB - + + DEBUG + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n @@ -38,11 +41,9 @@ 10MB 1GB - INFO - %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n @@ -62,9 +63,9 @@ - + - + \ No newline at end of file