SOLR-9428: Improve logging to log root cause

This commit is contained in:
Varun Thacker 2016-08-22 01:08:36 +05:30
parent c164d7f2b2
commit 364a29c0ab
2 changed files with 7 additions and 8 deletions

View File

@ -84,7 +84,7 @@ public abstract class ManagedResourceStorage {
* whether the core is running in cloud mode as well as initArgs.
*/
public static StorageIO newStorageIO(String collection, SolrResourceLoader resourceLoader, NamedList<String> initArgs) {
StorageIO storageIO = null;
StorageIO storageIO;
SolrZkClient zkClient = null;
String zkConfigName = null;
@ -94,9 +94,10 @@ public abstract class ManagedResourceStorage {
zkConfigName = ((ZkSolrResourceLoader)resourceLoader).getZkController().
getZkStateReader().readConfigName(collection);
} catch (Exception e) {
log.error("Failed to get config name for collection {} due to: {}",
collection, e.toString());
}
log.error("Failed to get config name due to", e);
throw new SolrException(ErrorCode.SERVER_ERROR,
"Failed to load config name for collection:" + collection + " due to: ", e);
}
if (zkConfigName == null) {
throw new SolrException(ErrorCode.SERVER_ERROR,
"Could not find config name for collection:" + collection);

View File

@ -192,10 +192,8 @@ public class ZkStateReader implements Closeable {
} else {
throw new ZooKeeperException(ErrorCode.INVALID_STATE, "No config data found at path: " + path);
}
} catch (KeeperException e) {
throw new SolrException(ErrorCode.SERVER_ERROR, "Error loading config name for collection " + collection, e);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
} catch (KeeperException| InterruptedException e) {
SolrZkClient.checkInterrupted(e);
throw new SolrException(ErrorCode.SERVER_ERROR, "Error loading config name for collection " + collection, e);
}