Explicitly use e.getMessage() for log message formatting

patch by Zhao Yang; reviewed by Stefan Podkowinski for CASSANDRA-13723
This commit is contained in:
Zhao Yang 2017-07-24 18:13:14 +08:00 committed by Stefan Podkowinski
parent bcdbee5cdc
commit ba87ab4e95
10 changed files with 16 additions and 12 deletions

View File

@ -129,7 +129,9 @@ public class CassandraAuthorizer implements IAuthorizer
}
catch (RequestExecutionException | RequestValidationException e)
{
logger.warn("CassandraAuthorizer failed to revoke all permissions of {}: {}", revokee.getRoleName(), e);
logger.warn("CassandraAuthorizer failed to revoke all permissions of {}: {}",
revokee.getRoleName(),
e.getMessage());
}
}
@ -166,7 +168,7 @@ public class CassandraAuthorizer implements IAuthorizer
}
catch (RequestExecutionException | RequestValidationException e)
{
logger.warn("CassandraAuthorizer failed to revoke all permissions on {}: {}", droppedResource, e);
logger.warn("CassandraAuthorizer failed to revoke all permissions on {}: {}", droppedResource, e.getMessage());
return;
}
}

View File

@ -272,7 +272,7 @@ public class BatchlogManager implements BatchlogManagerMBean
}
catch (IOException e)
{
logger.warn("Skipped batch replay of {} due to {}", id, e);
logger.warn("Skipped batch replay of {} due to {}", id, e.getMessage());
remove(id);
}

View File

@ -164,7 +164,7 @@ public abstract class AbstractLocalAwareExecutorService implements LocalAwareExe
catch (Throwable t)
{
JVMStabilityInspector.inspectThrowable(t);
logger.warn("Uncaught exception on thread {}: {}", Thread.currentThread(), t);
logger.warn("Uncaught exception on thread {}: {}", Thread.currentThread(), t.getMessage());
result = t;
failure = true;
}

View File

@ -142,9 +142,9 @@ final class SEPWorker extends AtomicReference<SEPWorker.Work> implements Runnabl
if (assigned != null)
assigned.returnWorkPermit();
if (task != null)
logger.error("Failed to execute task, unexpected exception killed worker: {}", t);
logger.error("Failed to execute task, unexpected exception killed worker: {}", t.getMessage());
else
logger.error("Unexpected exception killed worker: {}", t);
logger.error("Unexpected exception killed worker: {}", t.getMessage());
}
}

View File

@ -927,7 +927,7 @@ public class Directories
}
catch (IOException e)
{
logger.error("Could not calculate the size of {}. {}", input, e);
logger.error("Could not calculate the size of {}. {}", input, e.getMessage());
}
return visitor.getAllocatedSize();

View File

@ -240,7 +240,9 @@ final class HintsDispatchExecutor
}
catch (FSReadError e)
{
logger.error("Failed to dispatch hints file {}: file is corrupted ({})", descriptor.fileName(), e);
logger.error("Failed to dispatch hints file {}: file is corrupted ({})",
descriptor.fileName(),
e.getMessage());
store.cleanUp(descriptor);
store.blacklist(descriptor);
throw e;

View File

@ -489,7 +489,7 @@ public final class FileUtils
}
catch (IOException e)
{
logger.error("Error while getting {} folder size. {}", folder, e);
logger.error("Error while getting {} folder size. {}", folder, e.getMessage());
}
return sizeArr[0];
}

View File

@ -1768,7 +1768,7 @@ public class StorageProxy implements StorageProxyMBean
}
catch (DigestMismatchException ex)
{
Tracing.trace("Digest mismatch: {}", ex);
Tracing.trace("Digest mismatch: {}", ex.getMessage());
ReadRepairMetrics.repairedBlocking.mark();

View File

@ -65,7 +65,7 @@ public class DefaultConnectionFactory implements StreamConnectionFactory
throw e;
long waitms = DatabaseDescriptor.getRpcTimeout() * (long)Math.pow(2, attempts);
logger.warn("Failed attempt {} to connect to {}. Retrying in {} ms. ({})", attempts, peer, waitms, e);
logger.warn("Failed attempt {} to connect to {}. Retrying in {} ms. ({})", attempts, peer, waitms, e.getMessage());
try
{
Thread.sleep(waitms);

View File

@ -329,7 +329,7 @@ public final class NativeLibrary
if (!(e instanceof LastErrorException))
throw e;
logger.warn("fsync({}) failed, errorno ({}) {}", fd, errno(e), e);
logger.warn("fsync({}) failed, errorno ({}) {}", fd, errno(e), e.getMessage());
}
}