William R. Speirs created CASSANDRA-13368:
---------------------------------------------
Summary: Exception Stack not Printed as Intended in Error Logs
Key: CASSANDRA-13368
URL: https://issues.apache.org/jira/browse/CASSANDRA-13368
Project: Cassandra
Issue Type: Bug
Reporter: William R. Speirs
Priority: Trivial
There are a number of instances where it appears the programmer intended to
print a stack trace in an error message, but it is not actually being printed.
For example, in {{BlacklistedDirectories.java:54}}:
{noformat}
catch (Exception e)
{
JVMStabilityInspector.inspectThrowable(e);
logger.error("error registering MBean {}", MBEAN_NAME, e);
//Allow the server to start even if the bean can't be registered
}
{noformat}
The logger will use the second argument for the braces, but will ignore the
exception {{e}}. It would be helpful to have the stack traces of these
exceptions printed. I propose adding a second line that prints the full stack
trace: {{logger.error(e.getMessage(), e);}}
On the 2.1 branch, I found 8 instances of these types of messages:
{noformat}
db/BlacklistedDirectories.java:54: logger.error("error registering
MBean {}", MBEAN_NAME, e);
io/sstable/SSTableReader.java:512: logger.error("Corrupt sstable {};
skipped", descriptor, e);
net/OutboundTcpConnection.java:228: logger.error("error
processing a message intended for {}", poolReference.endPoint(), e);
net/OutboundTcpConnection.java:314: logger.error("error writing
to {}", poolReference.endPoint(), e);
service/CassandraDaemon.java:231: logger.error("Exception in
thread {}", t, e);
service/CassandraDaemon.java:562: logger.error("error
registering MBean {}", MBEAN_NAME, e);
streaming/StreamSession.java:512: logger.error("[Stream #{}]
Streaming error occurred", planId(), e);
transport/Server.java:442: logger.error("Problem retrieving RPC
address for {}", endpoint, e);
{noformat}
And one where it'll print the {{toString()}} version of the exception:
{noformat}
db/Directories.java:689: logger.error("Could not calculate the size
of {}. {}", input, e);
{noformat}
I'm happy to create a patch for each branch, just need a little guidance on how
to do so. We're currently running 2.1 so I started there.
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)