Skip to content

armgit / solr

Public Imported from GitHub
0

Apache Solr open-source search software

SOLR-15703: replace all SolrException.log usage in Solr to just call log.error(...) directly (#1513)

Kevin Risdenc7f5e85fb46a
diff --git a/gradle/validation/forbidden-apis/java.solr.txt b/gradle/validation/forbidden-apis/java.solr.txt
index de195d51d93..0644e3ce014 100644
--- a/gradle/validation/forbidden-apis/java.solr.txt
+++ b/gradle/validation/forbidden-apis/java.solr.txt
@@ -27,3 +27,6 @@ java.util.LinkedHashMap#<init>(int)
@defaultMessage Use CollectionUtil.newHashSet(int)
java.util.HashSet#<init>(int)
+@defaultMessage Use Logger directly
+org.apache.solr.common.SolrException#log(**)
+
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index f398e8f1aed..bacaae2978a 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -113,6 +113,8 @@ Other Changes
* SOLR-16507: Change SplitShardCmd to not use NodeStateProvider (Vinayak Hegde, David Smiley)
+* SOLR-15703: replace all SolrException.log usage in Solr to just call log.error(...) directly (Kevin Risden)
+
================== 9.2.0 ==================
New Features
diff --git a/solr/core/src/java/org/apache/solr/cloud/CloudUtil.java b/solr/core/src/java/org/apache/solr/cloud/CloudUtil.java
index 7461d6ef6c1..de9181e505c 100644
--- a/solr/core/src/java/org/apache/solr/cloud/CloudUtil.java
+++ b/solr/core/src/java/org/apache/solr/cloud/CloudUtil.java
@@ -90,25 +90,19 @@ public class CloudUtil {
try {
PathUtils.deleteDirectory(desc.getInstanceDir());
} catch (IOException e) {
- SolrException.log(
- log,
- "Failed to delete instance dir for core:"
- + desc.getName()
- + " dir:"
- + desc.getInstanceDir());
+ log.error(
+ "Failed to delete instance dir for core: {} dir: {}",
+ desc.getName(),
+ desc.getInstanceDir(),
+ e);
}
- log.error(
- "{}",
- new SolrException(
- ErrorCode.SERVER_ERROR,
- "Will not load SolrCore "
- + desc.getName()
- + " because it has been replaced due to failover.")); // nowarn
- throw new SolrException(
- ErrorCode.SERVER_ERROR,
+ String msg =
"Will not load SolrCore "
+ desc.getName()
- + " because it has been replaced due to failover.");
+ + " because it has been replaced due to failover.";
+ SolrException e = new SolrException(ErrorCode.SERVER_ERROR, msg);
+ log.error(msg, e);
+ throw e;
}
}
}
diff --git a/solr/core/src/java/org/apache/solr/cloud/OverseerConfigSetMessageHandler.java b/solr/core/src/java/org/apache/solr/cloud/OverseerConfigSetMessageHandler.java
index 6a01ceb5483..b4bdb8c94ba 100644
--- a/solr/core/src/java/org/apache/solr/cloud/OverseerConfigSetMessageHandler.java
+++ b/solr/core/src/java/org/apache/solr/cloud/OverseerConfigSetMessageHandler.java
@@ -93,10 +93,9 @@ public class OverseerConfigSetMessageHandler implements OverseerMessageHandler {
String configSetName = message.getStr(NAME);
if (configSetName == null) {
- SolrException.log(log, "Operation " + operation + " failed", e);
+ log.error("Operation {} failed", operation, e);
} else {
- SolrException.log(
- log, "ConfigSet: " + configSetName + " operation: " + operation + " failed", e);
+ log.error("ConfigSet: {} operation: {} failed", configSetName, operation, e);
}
results.add("Operation " + operation + " caused exception:", e);
diff --git a/solr/core/src/java/org/apache/solr/cloud/OverseerTaskProcessor.java b/solr/core/src/java/org/apache/solr/cloud/OverseerTaskProcessor.java
index 14685e8b26c..eb5661885c4 100644
--- a/solr/core/src/java/org/apache/solr/cloud/OverseerTaskProcessor.java
+++ b/solr/core/src/java/org/apache/solr/cloud/OverseerTaskProcessor.java
@@ -37,7 +37,6 @@ import java.util.function.Predicate;
import org.apache.solr.cloud.Overseer.LeaderStatus;
import org.apache.solr.cloud.OverseerTaskQueue.QueueEvent;
import org.apache.solr.common.AlreadyClosedException;
-import org.apache.solr.common.SolrException;
import org.apache.solr.common.cloud.SolrZkClient;
import org.apache.solr.common.cloud.ZkNodeProps;
import org.apache.solr.common.cloud.ZkStateReader;
@@ -188,7 +187,7 @@ public class OverseerTaskProcessor implements Runnable, Closeable {
} catch (KeeperException e) {
// We don't need to handle this. This is just a fail-safe which comes in handy in skipping
// already processed async calls.
- SolrException.log(log, "", e);
+ log.error("KeeperException", e);
} catch (AlreadyClosedException e) {
return;
} catch (InterruptedException e) {
@@ -383,7 +382,7 @@ public class OverseerTaskProcessor implements Runnable, Closeable {
log.warn("Overseer cannot talk to ZK");
return;
}
- SolrException.log(log, "", e);
+ log.error("KeeperException", e);
// Prevent free-spinning this loop.
try {
@@ -396,10 +395,10 @@ public class OverseerTaskProcessor implements Runnable, Closeable {
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
return;
- } catch (AlreadyClosedException e) {
+ } catch (AlreadyClosedException ignore) {
} catch (Exception e) {
- SolrException.log(log, "", e);
+ log.error("Exception processing", e);
}
}
} finally {
@@ -603,10 +602,10 @@ public class OverseerTaskProcessor implements Runnable, Closeable {
response.getResponse());
}
success = true;
- } catch (AlreadyClosedException e) {
+ } catch (AlreadyClosedException ignore) {
} catch (KeeperException e) {
- SolrException.log(log, "", e);
+ log.error("KeeperException", e);
} catch (InterruptedException e) {
// Reset task from tracking data structures so that it can be retried.
resetTaskWithException(messageHandler, head.getId(), asyncId, taskKey, message);
@@ -618,7 +617,7 @@ public class OverseerTaskProcessor implements Runnable, Closeable {
// Reset task from tracking data structures so that it can be retried.
try {
resetTaskWithException(messageHandler, head.getId(), asyncId, taskKey, message);
- } catch (AlreadyClosedException e) {
+ } catch (AlreadyClosedException ignore) {
}
}
@@ -658,7 +657,7 @@ public class OverseerTaskProcessor implements Runnable, Closeable {
runningTasks.remove(id);
} catch (KeeperException e) {
- SolrException.log(log, "", e);
+ log.error("KeeperException", e);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
}
diff --git a/solr/core/src/java/org/apache/solr/cloud/RecoveryStrategy.java b/solr/core/src/java/org/apache/solr/cloud/RecoveryStrategy.java
index 57961a1350d..0a9a09968a8 100644
--- a/solr/core/src/java/org/apache/solr/cloud/RecoveryStrategy.java
+++ b/solr/core/src/java/org/apache/solr/cloud/RecoveryStrategy.java
@@ -197,7 +197,7 @@ public class RecoveryStrategy implements Runnable, Closeable {
private final void recoveryFailed(final ZkController zkController, final CoreDescriptor cd)
throws Exception {
- SolrException.log(log, "Recovery failed - I give up.");
+ log.error("Recovery failed - I give up.");
try {
zkController.publish(cd, Replica.State.RECOVERY_FAILED);
} finally {
@@ -300,7 +300,7 @@ public class RecoveryStrategy implements Runnable, Closeable {
try (SolrCore core = cc.getCore(coreName)) {
if (core == null) {
- SolrException.log(log, "SolrCore not found - cannot recover:" + coreName);
+ log.error("SolrCore not found - cannot recover: {}", coreName);
return;
}
@@ -311,7 +311,7 @@ public class RecoveryStrategy implements Runnable, Closeable {
doRecovery(core);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
- SolrException.log(log, "", e);
+ log.error("interrupted", e);
throw new ZooKeeperException(SolrException.ErrorCode.SERVER_ERROR, "", e);
} catch (Exception e) {
log.error("", e);
@@ -343,7 +343,7 @@ public class RecoveryStrategy implements Runnable, Closeable {
boolean successfulRecovery = false;
// if (core.getUpdateHandler().getUpdateLog() != null) {
- // SolrException.log(log, "'replicate-only' recovery strategy should only be used if no update
+ // log.error("'replicate-only' recovery strategy should only be used if no update
// logs are present, but
// this core has one: "
// + core.getUpdateHandler().getUpdateLog());
@@ -405,11 +405,11 @@ public class RecoveryStrategy implements Runnable, Closeable {
log.info("Replication Recovery was successful.");
successfulRecovery = true;
} catch (Exception e) {
- SolrException.log(log, "Error while trying to recover", e);
+ log.error("Error while trying to recover", e);
}
} catch (Exception e) {
- SolrException.log(log, "Error while trying to recover. core=" + coreName, e);
+ log.error("Error while trying to recover. core={}", coreName, e);
} finally {
if (successfulRecovery) {
log.info("Restarting background replicate from leader process");
@@ -459,16 +459,16 @@ public class RecoveryStrategy implements Runnable, Closeable {
retries++;
if (retries >= maxRetries) {
- SolrException.log(log, "Recovery failed - max retries exceeded (" + retries + ").");
+ log.error("Recovery failed - max retries exceeded ({}).", retries);
try {
recoveryFailed(zkController, this.coreDescriptor);
} catch (Exception e) {
- SolrException.log(log, "Could not publish that recovery failed", e);
+ log.error("Could not publish that recovery failed", e);
}
return true;
}
} catch (Exception e) {
- SolrException.log(log, "An error has occurred during recovery", e);
+ log.error("An error has occurred during recovery", e);
}
try {
@@ -505,7 +505,7 @@ public class RecoveryStrategy implements Runnable, Closeable {
UpdateLog ulog;
ulog = core.getUpdateHandler().getUpdateLog();
if (ulog == null) {
- SolrException.log(log, "No UpdateLog found - cannot recover.");
+ log.error("No UpdateLog found - cannot recover.");
recoveryFailed(zkController, this.coreDescriptor);
return;
}
@@ -517,7 +517,7 @@ public class RecoveryStrategy implements Runnable, Closeable {
try (UpdateLog.RecentUpdates recentUpdates = ulog.getRecentUpdates()) {
recentVersions = recentUpdates.getVersions(ulog.getNumRecordsToKeep());
} catch (Exception e) {
- SolrException.log(log, "Corrupt tlog - ignoring.", e);
+ log.error("Corrupt tlog - ignoring.", e);
recentVersions = new ArrayList<>(0);
}
@@ -555,7 +555,7 @@ public class RecoveryStrategy implements Runnable, Closeable {
}
}
} catch (Exception e) {
- SolrException.log(log, "Error getting recent versions.", e);
+ log.error("Error getting recent versions.", e);
recentVersions = new ArrayList<>(0);
}
}
@@ -573,7 +573,7 @@ public class RecoveryStrategy implements Runnable, Closeable {
firstTime = false; // skip peersync
}
} catch (Exception e) {
- SolrException.log(log, "Error trying to get ulog starting operation.", e);
+ log.error("Error trying to get ulog starting operation.", e);
firstTime = false; // skip peersync
}
}
@@ -721,11 +721,11 @@ public class RecoveryStrategy implements Runnable, Closeable {
log.warn("Recovery was interrupted", e);
close = true;
} catch (Exception e) {
- SolrException.log(log, "Error while trying to recover", e);
+ log.error("Error while trying to recover", e);
}
} catch (Exception e) {
- SolrException.log(log, "Error while trying to recover. core=" + coreName, e);
+ log.error("Error while trying to recover. core={}", coreName, e);
} finally {
if (successfulRecovery) {
log.info("Registering as Active after recovery.");
@@ -851,7 +851,7 @@ public class RecoveryStrategy implements Runnable, Closeable {
// wait for replay
RecoveryInfo report = future.get();
if (report.failed) {
- SolrException.log(log, "Replay failed");
+ log.error("Replay failed");
throw new SolrException(ErrorCode.SERVER_ERROR, "Replay failed");
}
}
diff --git a/solr/core/src/java/org/apache/solr/cloud/ShardLeaderElectionContext.java b/solr/core/src/java/org/apache/solr/cloud/ShardLeaderElectionContext.java
index 4edf6f78773..898848887a4 100644
--- a/solr/core/src/java/org/apache/solr/cloud/ShardLeaderElectionContext.java
+++ b/solr/core/src/java/org/apache/solr/cloud/ShardLeaderElectionContext.java
@@ -207,7 +207,7 @@ final class ShardLeaderElectionContext extends ShardLeaderElectionContextBase {
result = syncStrategy.sync(zkController, core, leaderProps, weAreReplacement);
success = result.isSuccess();
} catch (Exception e) {
- SolrException.log(log, "Exception while trying to sync", e);
+ log.error("Exception while trying to sync", e);
result = PeerSync.PeerSyncResult.failure();
}
@@ -311,7 +311,7 @@ final class ShardLeaderElectionContext extends ShardLeaderElectionContextBase {
ErrorCode.SERVER_ERROR,
"ZK session expired - cancelling election for " + collection + " " + shardId);
} catch (Exception e) {
- SolrException.log(log, "There was a problem trying to register as the leader", e);
+ log.error("There was a problem trying to register as the leader", e);
try (SolrCore core = cc.getCore(coreName)) {
@@ -454,7 +454,7 @@ final class ShardLeaderElectionContext extends ShardLeaderElectionContextBase {
ErrorCode.SERVER_ERROR,
"ZK session expired - cancelling election for " + collection + " " + shardId);
}
- SolrException.log(log, "Error checking for the number of election participants", e);
+ log.error("Error checking for the number of election participants", e);
}
// on startup and after connection timeout, wait for all known shards
@@ -513,7 +513,7 @@ final class ShardLeaderElectionContext extends ShardLeaderElectionContextBase {
ErrorCode.SERVER_ERROR,
"ZK session expired - cancelling election for " + collection + " " + shardId);
}
- SolrException.log(log, "Error checking for the number of election participants", e);
+ log.error("Error checking for the number of election participants", e);
}
if (found >= slices.getReplicasMap().size()) {
diff --git a/solr/core/src/java/org/apache/solr/cloud/ShardLeaderElectionContextBase.java b/solr/core/src/java/org/apache/solr/cloud/ShardLeaderElectionContextBase.java
index b99764bdc42..3b17234b570 100644
--- a/solr/core/src/java/org/apache/solr/cloud/ShardLeaderElectionContextBase.java
+++ b/solr/core/src/java/org/apache/solr/cloud/ShardLeaderElectionContextBase.java
@@ -98,7 +98,6 @@ class ShardLeaderElectionContextBase extends ElectionContext {
super.cancelElection();
synchronized (lock) {
if (leaderZkNodeParentVersion != null) {
- // no problem
// no problem
try {
// We need to be careful and make sure we *only* delete our own leader registration node.
@@ -116,7 +115,7 @@ class ShardLeaderElectionContextBase extends ElectionContext {
} catch (InterruptedException e) {
throw e;
} catch (IllegalArgumentException e) {
- SolrException.log(log, e);
+ log.error("Illegal argument", e);
}
leaderZkNodeParentVersion = null;
} else {
diff --git a/solr/core/src/java/org/apache/solr/cloud/SyncStrategy.java b/solr/core/src/java/org/apache/solr/cloud/SyncStrategy.java
index f1cb20a2497..f07125cf975 100644
--- a/solr/core/src/java/org/apache/solr/cloud/SyncStrategy.java
+++ b/solr/core/src/java/org/apache/solr/cloud/SyncStrategy.java
@@ -29,7 +29,6 @@ import org.apache.solr.client.solrj.SolrClient;
import org.apache.solr.client.solrj.SolrServerException;
import org.apache.solr.client.solrj.impl.HttpSolrClient;
import org.apache.solr.client.solrj.request.CoreAdminRequest.RequestRecovery;
-import org.apache.solr.common.SolrException;
import org.apache.solr.common.cloud.ZkCoreNodeProps;
import org.apache.solr.common.cloud.ZkNodeProps;
import org.apache.solr.common.params.CoreAdminParams.CoreAdminAction;
@@ -137,7 +136,7 @@ public class SyncStrategy {
zkController, core, leaderProps, collection, shardId, peerSyncOnlyWithActive);
success = result.isSuccess();
} catch (Exception e) {
- SolrException.log(log, "Sync Failed", e);
+ log.error("Sync Failed", e);
}
try {
if (isClosed) {
@@ -162,7 +161,7 @@ public class SyncStrategy {
}
} catch (Exception e) {
- SolrException.log(log, "Sync Failed", e);
+ log.error("Sync Failed", e);
}
return result == null ? PeerSync.PeerSyncResult.failure() : result;
@@ -262,7 +261,7 @@ public class SyncStrategy {
nUpdates);
} catch (Exception e) {
- SolrException.log(log, "Error syncing replica to leader", e);
+ log.error("Error syncing replica to leader", e);
}
}
@@ -271,7 +270,7 @@ public class SyncStrategy {
if (srsp == null) break;
boolean success = handleResponse(srsp);
if (srsp.getException() != null) {
- SolrException.log(log, "Sync request error: " + srsp.getException());
+ log.error("Sync request error", srsp.getException());
}
if (!success) {
@@ -371,10 +370,9 @@ public class SyncStrategy {
.build()) {
client.request(recoverRequestCmd);
} catch (Throwable t) {
- SolrException.log(
- log,
- ZkCoreNodeProps.getCoreUrl(leaderProps)
- + ": Could not tell a replica to recover",
+ log.error(
+ "{}: Could not tell a replica to recover",
+ ZkCoreNodeProps.getCoreUrl(leaderProps),
t);
if (t instanceof Error) {
throw (Error) t;
diff --git a/solr/core/src/java/org/apache/solr/cloud/ZkController.java b/solr/core/src/java/org/apache/solr/cloud/ZkController.java
index a44cf3e8a6d..6a7a3f561d6 100644
--- a/solr/core/src/java/org/apache/solr/cloud/ZkController.java
+++ b/solr/core/src/java/org/apache/solr/cloud/ZkController.java
@@ -502,7 +502,7 @@ public class ZkController implements Closeable {
register(descriptor.getName(), descriptor, true, true, false);
}
} catch (Exception e) {
- SolrException.log(log, "Error registering SolrCore", e);
+ log.error("Error registering SolrCore", e);
}
}
}
@@ -536,7 +536,7 @@ public class ZkController implements Closeable {
} catch (SessionExpiredException e) {
throw e;
} catch (Exception e) {
- SolrException.log(log, "", e);
+ log.error("Exception during reconnect", e);
throw new ZooKeeperException(ErrorCode.SERVER_ERROR, "", e);
}
}
@@ -905,7 +905,7 @@ public class ZkController implements Closeable {
}
}
} catch (Exception e) {
- SolrException.log(log, "Error while looking for a better host name than 127.0.0.1", e);
+ log.error("Error while looking for a better host name than 127.0.0.1", e);
}
}
host = hostaddress;
@@ -2217,7 +2217,7 @@ public class ZkController implements Closeable {
}
}
- SolrException.log(log, "There was a problem making a request to the leader", e);
+ log.error("There was a problem making a request to the leader", e);
try {
Thread.sleep(2000);
} catch (InterruptedException e1) {
@@ -2230,7 +2230,7 @@ public class ZkController implements Closeable {
}
}
} catch (IOException e) {
- SolrException.log(log, "Error closing HttpSolrClient", e);
+ log.error("Error closing HttpSolrClient", e);
}
}
}
diff --git a/solr/core/src/java/org/apache/solr/cloud/api/collections/DeleteCollectionCmd.java b/solr/core/src/java/org/apache/solr/cloud/api/collections/DeleteCollectionCmd.java
index ac690993c7d..a1e9012aaf0 100644
--- a/solr/core/src/java/org/apache/solr/cloud/api/collections/DeleteCollectionCmd.java
+++ b/solr/core/src/java/org/apache/solr/cloud/api/collections/DeleteCollectionCmd.java
@@ -218,10 +218,10 @@ public class DeleteCollectionCmd implements CollApiCmds.CollectionApiCommand {
}
}
} catch (InterruptedException e) {
- SolrException.log(log, "Cleaning up collection in zk was interrupted:" + collection, e);
+ log.error("Cleaning up collection in zk was interrupted: {}", collection, e);
Thread.currentThread().interrupt();
} catch (KeeperException e) {
- SolrException.log(log, "Problem cleaning up collection in zk:" + collection, e);
+ log.error("Problem cleaning up collection in zk: {}", collection, e);
}
}
}
diff --git a/solr/core/src/java/org/apache/solr/cloud/api/collections/DistributedCollectionConfigSetCommandRunner.java b/solr/core/src/java/org/apache/solr/cloud/api/collections/DistributedCollectionConfigSetCommandRunner.java
index 07fe08f377b..9c7697caef2 100644
--- a/solr/core/src/java/org/apache/solr/cloud/api/collections/DistributedCollectionConfigSetCommandRunner.java
+++ b/solr/core/src/java/org/apache/solr/cloud/api/collections/DistributedCollectionConfigSetCommandRunner.java
@@ -454,9 +454,9 @@ public class DistributedCollectionConfigSetCommandRunner {
}
// Output some error logs
if (collName == null) {
- SolrException.log(log, "Operation " + action + " failed", e);
+ log.error("Operation {} failed", action, e);
} else {
- SolrException.log(log, "Collection " + collName + ", operation " + action + " failed", e);
+ log.error("Collection {}}, operation {} failed", collName, action, e);
}
results.add("Operation " + action + " caused exception:", e);
diff --git a/solr/core/src/java/org/apache/solr/cloud/api/collections/OverseerCollectionMessageHandler.java b/solr/core/src/java/org/apache/solr/cloud/api/collections/OverseerCollectionMessageHandler.java
index 8c3926160cd..a055bbd618f 100644
--- a/solr/core/src/java/org/apache/solr/cloud/api/collections/OverseerCollectionMessageHandler.java
+++ b/solr/core/src/java/org/apache/solr/cloud/api/collections/OverseerCollectionMessageHandler.java
@@ -132,10 +132,9 @@ public class OverseerCollectionMessageHandler implements OverseerMessageHandler,
if (collName == null) collName = message.getStr(NAME);
if (collName == null) {
- SolrException.log(log, "Operation " + operation + " failed", e);
+ log.error("Operation {} failed", operation, e);
} else {
- SolrException.log(
- log, "Collection: " + collName + " operation: " + operation + " failed", e);
+ log.error("Collection {}}, operation {} failed", collName, operation, e);
}
results.add("Operation " + operation + " caused exception:", e);
diff --git a/solr/core/src/java/org/apache/solr/core/CachingDirectoryFactory.java b/solr/core/src/java/org/apache/solr/core/CachingDirectoryFactory.java
index 14303fe04ea..9864ad7ee48 100644
--- a/solr/core/src/java/org/apache/solr/core/CachingDirectoryFactory.java
+++ b/solr/core/src/java/org/apache/solr/core/CachingDirectoryFactory.java
@@ -189,7 +189,7 @@ public abstract class CachingDirectoryFactory extends DirectoryFactory {
}
assert val.refCnt == 0 : val.refCnt;
} catch (Exception e) {
- SolrException.log(log, "Error closing directory", e);
+ log.error("Error closing directory", e);
}
}
@@ -206,7 +206,7 @@ public abstract class CachingDirectoryFactory extends DirectoryFactory {
}
}
} catch (Exception e) {
- SolrException.log(log, "Error closing directory", e);
+ log.error("Error closing directory", e);
}
}
@@ -215,7 +215,7 @@ public abstract class CachingDirectoryFactory extends DirectoryFactory {
try {
removeDirectory(val);
} catch (Exception e) {
- SolrException.log(log, "Error removing directory", e);
+ log.error("Error removing directory", e);
}
}
@@ -241,7 +241,7 @@ public abstract class CachingDirectoryFactory extends DirectoryFactory {
try {
listener.preClose();
} catch (Exception e) {
- SolrException.log(log, "Error executing preClose for directory", e);
+ log.error("Error executing preClose for directory", e);
}
}
}
@@ -283,7 +283,7 @@ public abstract class CachingDirectoryFactory extends DirectoryFactory {
try {
removeDirectory(val);
} catch (Exception e) {
- SolrException.log(log, "Error removing directory " + val.path + " before core close", e);
+ log.error("Error removing directory {} before core close", val.path, e);
}
} else {
removeEntries.add(val);
@@ -295,7 +295,7 @@ public abstract class CachingDirectoryFactory extends DirectoryFactory {
try {
listener.postClose();
} catch (Exception e) {
- SolrException.log(log, "Error executing postClose for directory", e);
+ log.error("Error executing postClose for directory", e);
}
}
}
@@ -320,7 +320,7 @@ public abstract class CachingDirectoryFactory extends DirectoryFactory {
}
assert ObjectReleaseTracker.release(val.directory);
} catch (Exception e) {
- SolrException.log(log, "Error closing directory", e);
+ log.error("Error closing directory", e);
}
}
diff --git a/solr/core/src/java/org/apache/solr/core/CoreContainer.java b/solr/core/src/java/org/apache/solr/core/CoreContainer.java
index 8168a22342d..0ae5951530f 100644
--- a/solr/core/src/java/org/apache/solr/core/CoreContainer.java
+++ b/solr/core/src/java/org/apache/solr/core/CoreContainer.java
@@ -1015,7 +1015,7 @@ public class CoreContainer {
try {
zkSys.registerInZk(core, true, false);
} catch (RuntimeException e) {
- SolrException.log(log, "Error registering SolrCore", e);
+ log.error("Error registering SolrCore", e);
}
return core;
}));
@@ -1380,7 +1380,7 @@ public class CoreContainer {
try {
core.getSolrCoreState().cancelRecovery();
} catch (Exception e) {
- SolrException.log(log, "Error canceling recovery for core", e);
+ log.error("Error canceling recovery for core", e);
}
}
}
@@ -1540,11 +1540,11 @@ public class CoreContainer {
getZkController().unregister(coreName, cd);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
- SolrException.log(log, null, e);
+ log.error("interrupted", e);
} catch (KeeperException e) {
- SolrException.log(log, null, e);
+ log.error("KeeperException unregistering core {}", coreName, e);
} catch (Exception e) {
- SolrException.log(log, null, e);
+ log.error("Exception unregistering core {}", coreName, e);
}
}
@@ -1802,7 +1802,7 @@ public class CoreContainer {
df.release(dir);
df.doneWithDirectory(dir);
} catch (IOException e) {
- SolrException.log(log, e);
+ log.error("Exception releasing {}", dir, e);
}
}
}
diff --git a/solr/core/src/java/org/apache/solr/core/DirectoryFactory.java b/solr/core/src/java/org/apache/solr/core/DirectoryFactory.java
index baa4bc9fcac..34bed4dc50e 100644
--- a/solr/core/src/java/org/apache/solr/core/DirectoryFactory.java
+++ b/solr/core/src/java/org/apache/solr/core/DirectoryFactory.java
@@ -34,7 +34,6 @@ import org.apache.lucene.store.FilterDirectory;
import org.apache.lucene.store.FlushInfo;
import org.apache.lucene.store.IOContext;
import org.apache.lucene.store.LockFactory;
-import org.apache.solr.common.SolrException;
import org.apache.solr.core.CachingDirectoryFactory.CloseListener;
import org.apache.solr.update.UpdateLog;
import org.apache.solr.util.plugin.NamedListInitializedPlugin;
@@ -301,7 +300,7 @@ public abstract class DirectoryFactory implements NamedListInitializedPlugin, Cl
}
}
} catch (IOException e) {
- SolrException.log(log, "Error deleting files from Directory", e);
+ log.error("Error deleting files from Directory", e);
isSuccess = false;
}
return isSuccess;
diff --git a/solr/core/src/java/org/apache/solr/core/SolrCore.java b/solr/core/src/java/org/apache/solr/core/SolrCore.java
index 89abf3e83da..ed3b00f97a9 100644
--- a/solr/core/src/java/org/apache/solr/core/SolrCore.java
+++ b/solr/core/src/java/org/apache/solr/core/SolrCore.java
@@ -423,16 +423,17 @@ public class SolrCore implements SolrInfoBean, Closeable {
lastNewIndexDir = result;
return result;
} catch (IOException e) {
- SolrException.log(log, "", e);
+ String errorMessage = "Error in getNewIndexDir, exception: ";
+ log.error(errorMessage, e);
// See SOLR-11687. It is inadvisable to assume we can do the right thing for any but a small
// number of exceptions that ware caught and swallowed in getIndexProperty.
- throw new SolrException(ErrorCode.SERVER_ERROR, "Error in getNewIndexDir, exception: ", e);
+ throw new SolrException(ErrorCode.SERVER_ERROR, errorMessage, e);
} finally {
if (dir != null) {
try {
getDirectoryFactory().release(dir);
} catch (IOException e) {
- SolrException.log(log, "", e);
+ log.error("Exception releasing {}", dir, e);
}
}
}
@@ -508,7 +509,7 @@ public class SolrCore implements SolrInfoBean, Closeable {
}
}
} catch (IOException e) {
- SolrException.log(log, "IO error while trying to get the size of the Directory", e);
+ log.error("IO error while trying to get the size of the Directory", e);
}
return size;
}
@@ -1493,7 +1494,7 @@ public class SolrCore implements SolrInfoBean, Closeable {
try {
directoryFactory.release(dir);
} catch (IOException e) {
- SolrException.log(log, "", e);
+ log.error("Exception releasing {}", dir, e);
}
}
}
@@ -1770,7 +1771,7 @@ public class SolrCore implements SolrInfoBean, Closeable {
try {
coreMetricManager.close();
} catch (Throwable e) {
- SolrException.log(log, e);
+ log.error("Exception closing coreMetricManager", e);
if (e instanceof Error) {
throw (Error) e;
}
@@ -1781,7 +1782,7 @@ public class SolrCore implements SolrInfoBean, Closeable {
try {
hook.preClose(this);
} catch (Throwable e) {
- SolrException.log(log, e);
+ log.error("Exception during preclose of hook {}", hook, e);
if (e instanceof Error) {
throw (Error) e;
}
@@ -1801,7 +1802,7 @@ public class SolrCore implements SolrInfoBean, Closeable {
updateHandler.close();
}
} catch (Throwable e) {
- SolrException.log(log, e);
+ log.error("Exception closing updateHandler", e);
if (e instanceof Error) {
throw (Error) e;
}
@@ -1817,7 +1818,7 @@ public class SolrCore implements SolrInfoBean, Closeable {
}
}
} catch (Throwable e) {
- SolrException.log(log, e);
+ log.error("Exception calling decrefSolrCoreState", e);
if (e instanceof Error) {
throw (Error) e;
}
@@ -1826,7 +1827,7 @@ public class SolrCore implements SolrInfoBean, Closeable {
try {
ExecutorUtil.shutdownAndAwaitTermination(searcherExecutor);
} catch (Throwable e) {
- SolrException.log(log, e);
+ log.error("Exception shutting down searcherExecutor", e);
if (e instanceof Error) {
throw (Error) e;
}
@@ -1843,7 +1844,7 @@ public class SolrCore implements SolrInfoBean, Closeable {
// tries to use it, and the exception handling code should close it.
closeSearcher();
} catch (Throwable e) {
- SolrException.log(log, e);
+ log.error("Exception closingSearcher", e);
if (e instanceof Error) {
throw (Error) e;
}
@@ -1853,14 +1854,14 @@ public class SolrCore implements SolrInfoBean, Closeable {
try {
cleanupOldIndexDirectories(false);
} catch (Exception e) {
- SolrException.log(log, e);
+ log.error("Exception cleanupOldIndexDirectories", e);
}
}
try {
infoRegistry.clear();
} catch (Throwable e) {
- SolrException.log(log, e);
+ log.error("Exception clearing infoRegistry", e);
if (e instanceof Error) {
throw (Error) e;
}
@@ -1871,18 +1872,17 @@ public class SolrCore implements SolrInfoBean, Closeable {
try {
this.directoryFactory.release(snapshotsDir);
} catch (Throwable e) {
- SolrException.log(log, e);
+ log.error("Exception releasing snapshotsDir {}", snapshotsDir, e);
if (e instanceof Error) {
throw (Error) e;
}
}
if (coreStateClosed) {
-
try {
directoryFactory.close();
} catch (Throwable e) {
- SolrException.log(log, e);
+ log.error("Exception closing directoryFactory", e);
if (e instanceof Error) {
throw (Error) e;
}
@@ -1894,7 +1894,7 @@ public class SolrCore implements SolrInfoBean, Closeable {
try {
hook.postClose(this);
} catch (Throwable e) {
- SolrException.log(log, e);
+ log.error("Exception during postClose of hook {}", hook, e);
if (e instanceof Error) {
throw (Error) e;
}
@@ -2627,7 +2627,7 @@ public class SolrCore implements SolrInfoBean, Closeable {
try {
newSearcher.warm(currSearcher);
} catch (Throwable e) {
- SolrException.log(log, e);
+ log.error("Exception warming new searcher", e);
if (e instanceof Error) {
throw (Error) e;
}
@@ -2642,14 +2642,14 @@ public class SolrCore implements SolrInfoBean, Closeable {
future =
searcherExecutor.submit(
() -> {
- try {
- for (SolrEventListener listener : firstSearcherListeners) {
+ for (SolrEventListener listener : firstSearcherListeners) {
+ try {
listener.newSearcher(newSearcher, null);
- }
- } catch (Throwable e) {
- SolrException.log(log, null, e);
- if (e instanceof Error) {
- throw (Error) e;
+ } catch (Throwable e) {
+ log.error("Exception firing listener {} for new searcher", listener, e);
+ if (e instanceof Error) {
+ throw e;
+ }
}
}
return null;
@@ -2660,14 +2660,14 @@ public class SolrCore implements SolrInfoBean, Closeable {
future =
searcherExecutor.submit(
() -> {
- try {
- for (SolrEventListener listener : newSearcherListeners) {
+ for (SolrEventListener listener : newSearcherListeners) {
+ try {
listener.newSearcher(newSearcher, currSearcher);
- }
- } catch (Throwable e) {
- SolrException.log(log, null, e);
- if (e instanceof Error) {
- throw (Error) e;
+ } catch (Throwable e) {
+ log.error("Exception firing listener {} for new searcher", listener, e);
+ if (e instanceof Error) {
+ throw (Error) e;
+ }
}
}
return null;
@@ -2687,7 +2687,7 @@ public class SolrCore implements SolrInfoBean, Closeable {
// do a notify, even if it fails.
registerSearcher(newSearchHolder);
} catch (Throwable e) {
- SolrException.log(log, e);
+ log.error("Exception registering new searcher", e);
if (e instanceof Error) {
throw (Error) e;
}
@@ -2772,7 +2772,7 @@ public class SolrCore implements SolrInfoBean, Closeable {
} catch (Exception e) {
// do not allow decref() operations to fail since they are typically called in finally
// blocks and throwing another exception would be very unexpected.
- SolrException.log(log, "Error closing searcher:" + this, e);
+ log.error("Error closing searcher: {}", this, e);
}
}
};
@@ -2832,7 +2832,7 @@ public class SolrCore implements SolrInfoBean, Closeable {
} catch (Exception e) {
// an exception in register() shouldn't be fatal.
- log(e);
+ log.error("Exception in register()", e);
} finally {
// wake up anyone waiting for a searcher
// even in the face of errors.
@@ -3013,10 +3013,6 @@ public class SolrCore implements SolrInfoBean, Closeable {
}
}
- public static final void log(Throwable e) {
- SolrException.log(log, null, e);
- }
-
public PluginBag<QueryResponseWriter> getResponseWriters() {
return responseWriters;
}
@@ -3294,16 +3290,16 @@ public class SolrCore implements SolrInfoBean, Closeable {
try {
directoryFactory.remove(getIndexDir());
} catch (Exception e) {
- SolrException.log(
- log, "Failed to flag index dir for removal for core:" + name + " dir:" + getIndexDir());
+ log.error(
+ "Failed to flag index dir for removal for core: {} dir: {}", name, getIndexDir(), e);
}
}
if (deleteDataDir) {
try {
directoryFactory.remove(getDataDir(), true);
} catch (Exception e) {
- SolrException.log(
- log, "Failed to flag data dir for removal for core:" + name + " dir:" + getDataDir());
+ log.error(
+ "Failed to flag data dir for removal for core: {} dir: {}", name, getDataDir(), e);
}
}
if (deleteInstanceDir) {
@@ -3315,12 +3311,11 @@ public class SolrCore implements SolrInfoBean, Closeable {
try {
PathUtils.deleteDirectory(desc.getInstanceDir());
} catch (IOException e) {
- SolrException.log(
- log,
- "Failed to delete instance dir for core:"
- + core.getName()
- + " dir:"
- + desc.getInstanceDir());
+ log.error(
+ "Failed to delete instance dir for core: {} dir: {}",
+ core.getName(),
+ desc.getInstanceDir(),
+ e);
}
}
}
diff --git a/solr/core/src/java/org/apache/solr/core/SolrCores.java b/solr/core/src/java/org/apache/solr/core/SolrCores.java
index 0f6616a4586..4ea3974f0f8 100644
--- a/solr/core/src/java/org/apache/solr/core/SolrCores.java
+++ b/solr/core/src/java/org/apache/solr/core/SolrCores.java
@@ -127,7 +127,7 @@ public class SolrCores {
try {
core.close();
} catch (Throwable e) {
- SolrException.log(log, "Error shutting down core", e);
+ log.error("Error shutting down core", e);
if (e instanceof Error) {
throw (Error) e;
}
diff --git a/solr/core/src/java/org/apache/solr/core/XmlConfigFile.java b/solr/core/src/java/org/apache/solr/core/XmlConfigFile.java
index 3433635002d..554d0c56a6f 100644
--- a/solr/core/src/java/org/apache/solr/core/XmlConfigFile.java
+++ b/solr/core/src/java/org/apache/solr/core/XmlConfigFile.java
@@ -138,7 +138,7 @@ public class XmlConfigFile { // formerly simply "Config"
doc = SafeXMLParsing.parseConfigXML(log, loader, name);
}
} catch (SAXException e) {
- SolrException.log(log, "Exception during parsing file: " + name, e);
+ log.error("Exception during parsing file: {}", name, e);
throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, e);
} finally {
// XML Parser should close but in exceptional cases might not; so let's be safe
@@ -242,14 +242,10 @@ public class XmlConfigFile { // formerly simply "Config"
log.trace("{}:{}={}", name, path, nd);
return nd;
- } catch (XPathExpressionException e) {
- SolrException.log(log, "Error in xpath", e);
- throw new SolrException(
- SolrException.ErrorCode.SERVER_ERROR, "Error in xpath:" + xstr + " for " + name, e);
} catch (SolrException e) {
throw (e);
} catch (Exception e) {
- SolrException.log(log, "Error in xpath", e);
+ log.error("Error in xpath", e);
throw new SolrException(
SolrException.ErrorCode.SERVER_ERROR, "Error in xpath:" + xstr + " for " + name, e);
}
@@ -274,14 +270,10 @@ public class XmlConfigFile { // formerly simply "Config"
log.trace("{}:{}={}", name, path, nodeList);
return nodeList;
- } catch (XPathExpressionException e) {
- SolrException.log(log, "Error in xpath", e);
- throw new SolrException(
- SolrException.ErrorCode.SERVER_ERROR, "Error in xpath:" + xstr + " for " + name, e);
} catch (SolrException e) {
throw (e);
} catch (Exception e) {
- SolrException.log(log, "Error in xpath", e);
+ log.error("Error in xpath", e);
throw new SolrException(
SolrException.ErrorCode.SERVER_ERROR, "Error in xpath:" + xstr + " for " + name, e);
}
@@ -344,7 +336,7 @@ public class XmlConfigFile { // formerly simply "Config"
}
message.insert(0, "Unknown attribute(s) on element(s): ");
String msg = message.toString();
- SolrException.log(log, msg);
+ log.error(msg);
throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, msg);
}
}
diff --git a/solr/core/src/java/org/apache/solr/core/ZkContainer.java b/solr/core/src/java/org/apache/solr/core/ZkContainer.java
index 7f67496fb7e..ba0c040e1da 100644
--- a/solr/core/src/java/org/apache/solr/core/ZkContainer.java
+++ b/solr/core/src/java/org/apache/solr/core/ZkContainer.java
@@ -219,21 +219,21 @@ public class ZkContainer {
} catch (InterruptedException e) {
// Restore the interrupted status
Thread.currentThread().interrupt();
- SolrException.log(log, "", e);
+ log.error("Interrupted", e);
} catch (KeeperException e) {
- SolrException.log(log, "", e);
- } catch (AlreadyClosedException e) {
+ log.error("KeeperException registering core {}", core.getName(), e);
+ } catch (AlreadyClosedException ignore) {
} catch (Exception e) {
+ log.error("Exception registering core {}", core.getName(), e);
try {
zkController.publish(cd, Replica.State.DOWN);
} catch (InterruptedException e1) {
Thread.currentThread().interrupt();
- log.error("", e1);
+ log.error("Interrupted", e1);
} catch (Exception e1) {
- log.error("", e1);
+ log.error("Exception publishing down state for core {}", core.getName(), e1);
}
- SolrException.log(log, "", e);
}
} finally {
MDCLoggingContext.clear();
diff --git a/solr/core/src/java/org/apache/solr/handler/GraphHandler.java b/solr/core/src/java/org/apache/solr/handler/GraphHandler.java
index b5a8dfc7a05..07667983f5a 100644
--- a/solr/core/src/java/org/apache/solr/handler/GraphHandler.java
+++ b/solr/core/src/java/org/apache/solr/handler/GraphHandler.java
@@ -34,7 +34,6 @@ import org.apache.solr.client.solrj.io.stream.expr.DefaultStreamFactory;
import org.apache.solr.client.solrj.io.stream.expr.Explanation;
import org.apache.solr.client.solrj.io.stream.expr.Expressible;
import org.apache.solr.client.solrj.io.stream.expr.StreamFactory;
-import org.apache.solr.common.SolrException;
import org.apache.solr.common.params.CommonParams;
import org.apache.solr.common.params.ModifiableSolrParams;
import org.apache.solr.common.params.SolrParams;
@@ -142,7 +141,7 @@ public class GraphHandler extends RequestHandlerBase
} catch (Exception e) {
// Catch exceptions that occur while the stream is being created. This will include streaming
// expression parse rules.
- SolrException.log(log, e);
+ log.error("Exception constructing stream", e);
Map<Object, Object> requestContext = req.getContext();
requestContext.put("stream", new DummyErrorStream(e));
return;
diff --git a/solr/core/src/java/org/apache/solr/handler/IndexFetcher.java b/solr/core/src/java/org/apache/solr/handler/IndexFetcher.java
index d03871d9ec5..73dd762e158 100644
--- a/solr/core/src/java/org/apache/solr/handler/IndexFetcher.java
+++ b/solr/core/src/java/org/apache/solr/handler/IndexFetcher.java
@@ -855,24 +855,24 @@ public class IndexFetcher {
core.getDirectoryFactory().remove(tmpIndexDir);
}
} catch (Exception e) {
- SolrException.log(log, e);
+ log.error("Error cleaning up tmpIndexDir", e);
} finally {
try {
if (tmpIndexDir != null) core.getDirectoryFactory().release(tmpIndexDir);
} catch (Exception e) {
- SolrException.log(log, e);
+ log.error("Error releasing tmpIndexDir", e);
}
try {
if (indexDir != null) {
core.getDirectoryFactory().release(indexDir);
}
} catch (Exception e) {
- SolrException.log(log, e);
+ log.error("Error releasing indexDir", e);
}
try {
if (tmpTlogDir != null) delTree(tmpTlogDir);
} catch (Exception e) {
- SolrException.log(log, e);
+ log.error("Error deleting tmpTlogDir", e);
}
}
}
@@ -1045,7 +1045,7 @@ public class IndexFetcher {
try {
waitSearcher[0].get();
} catch (InterruptedException | ExecutionException e) {
- SolrException.log(log, e);
+ log.error("Exception waiting for searcher", e);
}
}
commitPoint = searcher.get().getIndexReader().getIndexCommit();
@@ -1432,7 +1432,7 @@ public class IndexFetcher {
return false;
}
} catch (IOException e) {
- SolrException.log(log, "could not check if a file exists", e);
+ log.error("could not check if a file exists", e);
return false;
}
try {
@@ -1441,7 +1441,7 @@ public class IndexFetcher {
.move(tmpIdxDir, indexDir, fname, DirectoryFactory.IOCONTEXT_NO_CACHE);
success = true;
} catch (IOException e) {
- SolrException.log(log, "Could not move file", e);
+ log.error("Could not move file", e);
}
return success;
}
@@ -1550,7 +1550,7 @@ public class IndexFetcher {
try {
Files.move(tlogDir, backupTlogDir, StandardCopyOption.ATOMIC_MOVE);
} catch (IOException e) {
- SolrException.log(log, "Unable to rename: " + tlogDir + " to: " + backupTlogDir, e);
+ log.error("Unable to rename: {} to: {}", tlogDir, backupTlogDir, e);
return false;
}
@@ -1560,7 +1560,7 @@ public class IndexFetcher {
try {
Files.move(src, tlogDir, StandardCopyOption.ATOMIC_MOVE);
} catch (IOException e) {
- SolrException.log(log, "Unable to rename: " + src + " to: " + tlogDir, e);
+ log.error("Unable to rename: {} to: {}", src, tlogDir, e);
// In case of error, try to revert back the original tlog directory
try {
@@ -1779,7 +1779,7 @@ public class IndexFetcher {
fetch();
} catch (Exception e) {
if (!aborted) {
- SolrException.log(IndexFetcher.log, "Error fetching file, doing one retry...", e);
+ IndexFetcher.log.error("Error fetching file, doing one retry...", e);
// one retry
fetch();
} else {
diff --git a/solr/core/src/java/org/apache/solr/handler/ReplicationHandler.java b/solr/core/src/java/org/apache/solr/handler/ReplicationHandler.java
index eebb00023c3..404d2524d8e 100644
--- a/solr/core/src/java/org/apache/solr/handler/ReplicationHandler.java
+++ b/solr/core/src/java/org/apache/solr/handler/ReplicationHandler.java
@@ -482,7 +482,7 @@ public class ReplicationHandler extends RequestHandlerBase implements SolrCoreAw
}
return currentIndexFetcher.fetchLatestIndex(forceReplication);
} catch (Exception e) {
- SolrException.log(log, "Index fetch failed ", e);
+ log.error("Index fetch failed", e);
if (currentIndexFetcher != pollingIndexFetcher) {
currentIndexFetcher.destroy();
}
@@ -775,7 +775,7 @@ public class ReplicationHandler extends RequestHandlerBase implements SolrCoreAw
try {
core.getDirectoryFactory().release(dir);
} catch (IOException e) {
- SolrException.log(log, "Could not release directory after fetching file list", e);
+ log.error("Could not release directory after fetching file list", e);
}
}
}
diff --git a/solr/core/src/java/org/apache/solr/handler/RequestHandlerBase.java b/solr/core/src/java/org/apache/solr/handler/RequestHandlerBase.java
index f418b248954..3a3c89f2b8a 100644
--- a/solr/core/src/java/org/apache/solr/handler/RequestHandlerBase.java
+++ b/solr/core/src/java/org/apache/solr/handler/RequestHandlerBase.java
@@ -252,11 +252,12 @@ public abstract class RequestHandlerBase
}
}
- SolrException.log(log, e);
metrics.numErrors.mark();
if (isClientError) {
+ log.error("Client exception", e);
metrics.numClientErrors.mark();
} else {
+ log.error("Server exception", e);
metrics.numServerErrors.mark();
}
}
diff --git a/solr/core/src/java/org/apache/solr/handler/StreamHandler.java b/solr/core/src/java/org/apache/solr/handler/StreamHandler.java
index 6b19393719b..a9ba23eeeb4 100644
--- a/solr/core/src/java/org/apache/solr/handler/StreamHandler.java
+++ b/solr/core/src/java/org/apache/solr/handler/StreamHandler.java
@@ -48,7 +48,6 @@ import org.apache.solr.client.solrj.io.stream.expr.StreamFactory;
import org.apache.solr.client.solrj.routing.RequestReplicaListTransformerGenerator;
import org.apache.solr.cloud.ZkController;
import org.apache.solr.common.MapWriter;
-import org.apache.solr.common.SolrException;
import org.apache.solr.common.cloud.ZkStateReader;
import org.apache.solr.common.params.CommonParams;
import org.apache.solr.common.params.ModifiableSolrParams;
@@ -194,7 +193,7 @@ public class StreamHandler extends RequestHandlerBase
} catch (Exception e) {
// Catch exceptions that occur while the stream is being created. This will include streaming
// expression parse rules.
- SolrException.log(log, e);
+ log.error("Exception creating stream", e);
rsp.add(StreamParams.RESULT_SET, new DummyErrorStream(e));
return;
diff --git a/solr/core/src/java/org/apache/solr/handler/admin/RequestApplyUpdatesOp.java b/solr/core/src/java/org/apache/solr/handler/admin/RequestApplyUpdatesOp.java
index 51d7a107b33..9fee3a76cb5 100644
--- a/solr/core/src/java/org/apache/solr/handler/admin/RequestApplyUpdatesOp.java
+++ b/solr/core/src/java/org/apache/solr/handler/admin/RequestApplyUpdatesOp.java
@@ -51,7 +51,7 @@ class RequestApplyUpdatesOp implements CoreAdminHandler.CoreAdminOp {
}
UpdateLog.RecoveryInfo report = future.get();
if (report.failed) {
- SolrException.log(CoreAdminOperation.log(), "Replay failed");
+ CoreAdminOperation.log().error("Replay failed");
throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, "Replay failed");
}
coreContainer.getZkController().publish(core.getCoreDescriptor(), Replica.State.ACTIVE);
@@ -61,7 +61,7 @@ class RequestApplyUpdatesOp implements CoreAdminHandler.CoreAdminOp {
Thread.currentThread().interrupt();
CoreAdminOperation.log().warn("Recovery was interrupted", e);
} catch (Exception e) {
- if (e instanceof SolrException) throw (SolrException) e;
+ if (e instanceof SolrException) throw e;
else
throw new SolrException(
SolrException.ErrorCode.SERVER_ERROR, "Could not apply buffered updates", e);
diff --git a/solr/core/src/java/org/apache/solr/handler/admin/RequestSyncShardOp.java b/solr/core/src/java/org/apache/solr/handler/admin/RequestSyncShardOp.java
index e351efc91ac..d781834e3e7 100644
--- a/solr/core/src/java/org/apache/solr/handler/admin/RequestSyncShardOp.java
+++ b/solr/core/src/java/org/apache/solr/handler/admin/RequestSyncShardOp.java
@@ -89,7 +89,7 @@ class RequestSyncShardOp implements CoreAdminHandler.CoreAdminOp {
throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, "Sync Failed");
}
} else {
- SolrException.log(log, "Could not find core to call sync:" + cname);
+ log.error("Could not find core to call sync: {}", cname);
}
} finally {
// no recoveryStrat close for now
diff --git a/solr/core/src/java/org/apache/solr/handler/export/ExportWriter.java b/solr/core/src/java/org/apache/solr/handler/export/ExportWriter.java
index 50588d70572..6b40fc69175 100644
--- a/solr/core/src/java/org/apache/solr/handler/export/ExportWriter.java
+++ b/solr/core/src/java/org/apache/solr/handler/export/ExportWriter.java
@@ -50,7 +50,6 @@ import org.apache.solr.common.IteratorWriter;
import org.apache.solr.common.MapWriter;
import org.apache.solr.common.MapWriter.EntryWriter;
import org.apache.solr.common.PushWriter;
-import org.apache.solr.common.SolrException;
import org.apache.solr.common.params.CommonParams;
import org.apache.solr.common.params.SolrParams;
import org.apache.solr.common.params.StreamParams;
@@ -175,7 +174,7 @@ public class ExportWriter implements SolrCore.RawWriter, Closeable {
singletonList(singletonMap("EXCEPTION", e.getMessage()))));
});
if (logException) {
- SolrException.log(log, e);
+ log.error("Exception", e);
}
}
diff --git a/solr/core/src/java/org/apache/solr/request/SolrRequestInfo.java b/solr/core/src/java/org/apache/solr/request/SolrRequestInfo.java
index c4ba7dcfe7f..e90e33ee8fa 100644
--- a/solr/core/src/java/org/apache/solr/request/SolrRequestInfo.java
+++ b/solr/core/src/java/org/apache/solr/request/SolrRequestInfo.java
@@ -27,7 +27,6 @@ import java.util.List;
import java.util.TimeZone;
import java.util.concurrent.atomic.AtomicReference;
import javax.servlet.http.HttpServletRequest;
-import org.apache.solr.common.SolrException;
import org.apache.solr.common.params.CommonParams;
import org.apache.solr.common.util.ExecutorUtil;
import org.apache.solr.handler.component.ResponseBuilder;
@@ -122,7 +121,7 @@ public class SolrRequestInfo {
try {
hook.close();
} catch (Exception e) {
- SolrException.log(log, "Exception during close hook", e);
+ log.error("Exception during close hook", e);
}
}
}
diff --git a/solr/core/src/java/org/apache/solr/search/CacheConfig.java b/solr/core/src/java/org/apache/solr/search/CacheConfig.java
index 7dc154bed9e..e7e2063f031 100644
--- a/solr/core/src/java/org/apache/solr/search/CacheConfig.java
+++ b/solr/core/src/java/org/apache/solr/search/CacheConfig.java
@@ -27,7 +27,6 @@ import java.util.Map;
import java.util.function.Supplier;
import org.apache.solr.common.ConfigNode;
import org.apache.solr.common.MapSerializable;
-import org.apache.solr.common.SolrException;
import org.apache.solr.common.util.CollectionUtil;
import org.apache.solr.common.util.StrUtils;
import org.apache.solr.core.PluginInfo;
@@ -163,7 +162,7 @@ public class CacheConfig implements MapSerializable {
persistence[0] = cache.init(args, persistence[0], regenerator);
return cache;
} catch (Exception e) {
- SolrException.log(log, "Error instantiating cache", e);
+ log.error("Error instantiating cache", e);
// we can carry on without a cache... but should we?
// in some cases (like an OOM) we probably should try to continue.
return null;
diff --git a/solr/core/src/java/org/apache/solr/search/CaffeineCache.java b/solr/core/src/java/org/apache/solr/search/CaffeineCache.java
index e1263a6ed49..146a6c37326 100644
--- a/solr/core/src/java/org/apache/solr/search/CaffeineCache.java
+++ b/solr/core/src/java/org/apache/solr/search/CaffeineCache.java
@@ -42,7 +42,6 @@ import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.LongAdder;
import org.apache.lucene.util.Accountable;
import org.apache.lucene.util.RamUsageEstimator;
-import org.apache.solr.common.SolrException;
import org.apache.solr.metrics.MetricsMap;
import org.apache.solr.metrics.SolrMetricsContext;
import org.apache.solr.util.IOFunction;
@@ -405,7 +404,7 @@ public class CaffeineCache<K, V> extends SolrCacheBase
break;
}
} catch (Exception e) {
- SolrException.log(log, "Error during auto-warming of key:" + entry.getKey(), e);
+ log.error("Error during auto-warming of key: {}", entry.getKey(), e);
}
}
diff --git a/solr/core/src/java/org/apache/solr/search/QueryContext.java b/solr/core/src/java/org/apache/solr/search/QueryContext.java
index 2950aa73618..335e73ac151 100644
--- a/solr/core/src/java/org/apache/solr/search/QueryContext.java
+++ b/solr/core/src/java/org/apache/solr/search/QueryContext.java
@@ -21,7 +21,6 @@ import java.io.IOException;
import java.lang.invoke.MethodHandles;
import java.util.IdentityHashMap;
import org.apache.lucene.search.IndexSearcher;
-import org.apache.solr.common.SolrException;
import org.apache.solr.request.SolrRequestInfo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -97,7 +96,7 @@ public class QueryContext extends IdentityHashMap implements Closeable {
try {
hook.close();
} catch (Exception e) {
- SolrException.log(log, "Exception during close hook", e);
+ log.error("Exception during close hook", e);
}
}
}
diff --git a/solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.java b/solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.java
index 421e79994f7..96a3d628bf4 100644
--- a/solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.java
+++ b/solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.java
@@ -579,7 +579,7 @@ public class SolrIndexSearcher extends IndexSearcher implements Closeable, SolrI
try {
if (closeReader) rawReader.decRef();
} catch (Exception e) {
- SolrException.log(log, "Problem dec ref'ing reader", e);
+ log.error("Problem dec ref'ing reader", e);
}
if (directoryFactory.searchersReserveCommitPoints()) {
@@ -590,7 +590,7 @@ public class SolrIndexSearcher extends IndexSearcher implements Closeable, SolrI
try {
cache.close();
} catch (Exception e) {
- SolrException.log(log, "Exception closing cache " + cache.name(), e);
+ log.error("Exception closing cache {}", cache.name(), e);
}
}
diff --git a/solr/core/src/java/org/apache/solr/servlet/CoreContainerProvider.java b/solr/core/src/java/org/apache/solr/servlet/CoreContainerProvider.java
index e8880270621..fba2870063c 100644
--- a/solr/core/src/java/org/apache/solr/servlet/CoreContainerProvider.java
+++ b/solr/core/src/java/org/apache/solr/servlet/CoreContainerProvider.java
@@ -251,8 +251,7 @@ public class CoreContainerProvider implements ServletContextListener {
}
} catch (Throwable t) {
// catch this so our filter still works
- log.error("Could not start Solr. Check solr/home property and the logs");
- SolrCore.log(t);
+ log.error("Could not start Solr. Check solr/home property and the logs", t);
if (t instanceof Error) {
throw (Error) t;
}
diff --git a/solr/core/src/java/org/apache/solr/servlet/ResponseUtils.java b/solr/core/src/java/org/apache/solr/servlet/ResponseUtils.java
index 54c8f9e5d1f..9471b64befe 100644
--- a/solr/core/src/java/org/apache/solr/servlet/ResponseUtils.java
+++ b/solr/core/src/java/org/apache/solr/servlet/ResponseUtils.java
@@ -72,7 +72,7 @@ public class ResponseUtils {
if (code == 500 || code < 100) {
StringWriter sw = new StringWriter();
ex.printStackTrace(new PrintWriter(sw));
- SolrException.log(log, ex);
+ log.error("500 Exception", ex);
info.add("trace", sw.toString());
// non standard codes have undefined results with various servers
@@ -122,7 +122,7 @@ public class ResponseUtils {
if (code == 500 || code < 100) {
StringWriter sw = new StringWriter();
ex.printStackTrace(new PrintWriter(sw));
- SolrException.log(log, ex);
+ log.error("500 Exception", ex);
errorInfo.trace = sw.toString();
// non standard codes have undefined results with various servers
diff --git a/solr/core/src/java/org/apache/solr/servlet/SolrDispatchFilter.java b/solr/core/src/java/org/apache/solr/servlet/SolrDispatchFilter.java
index 29003c78d53..44c02cce109 100644
--- a/solr/core/src/java/org/apache/solr/servlet/SolrDispatchFilter.java
+++ b/solr/core/src/java/org/apache/solr/servlet/SolrDispatchFilter.java
@@ -49,7 +49,6 @@ import org.apache.solr.common.util.ExecutorUtil;
import org.apache.solr.common.util.SuppressForbidden;
import org.apache.solr.core.CoreContainer;
import org.apache.solr.core.NodeRoles;
-import org.apache.solr.core.SolrCore;
import org.apache.solr.handler.api.V2ApiUtils;
import org.apache.solr.logging.MDCLoggingContext;
import org.apache.solr.logging.MDCSnapshot;
@@ -161,8 +160,7 @@ public class SolrDispatchFilter extends BaseSolrFilter implements PathExcluder {
} catch (Throwable t) {
// catch this so our filter still works
- log.error("Could not start Dispatch Filter.");
- SolrCore.log(t);
+ log.error("Could not start Dispatch Filter.", t);
if (t instanceof Error) {
throw (Error) t;
}
diff --git a/solr/core/src/java/org/apache/solr/update/CommitTracker.java b/solr/core/src/java/org/apache/solr/update/CommitTracker.java
index dd8b0680dbc..54516430040 100644
--- a/solr/core/src/java/org/apache/solr/update/CommitTracker.java
+++ b/solr/core/src/java/org/apache/solr/update/CommitTracker.java
@@ -24,7 +24,6 @@ import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicLong;
-import org.apache.solr.common.SolrException;
import org.apache.solr.common.params.ModifiableSolrParams;
import org.apache.solr.common.util.SolrNamedThreadFactory;
import org.apache.solr.core.SolrCore;
@@ -279,7 +278,7 @@ public final class CommitTracker implements Runnable {
core.getUpdateHandler().commit(command);
} catch (Exception e) {
- SolrException.log(log, "auto commit error...", e);
+ log.error("auto commit error...", e);
} finally {
MDCLoggingContext.clear();
}
diff --git a/solr/core/src/java/org/apache/solr/update/DefaultSolrCoreState.java b/solr/core/src/java/org/apache/solr/update/DefaultSolrCoreState.java
index 19b8e480265..732304af8bb 100644
--- a/solr/core/src/java/org/apache/solr/update/DefaultSolrCoreState.java
+++ b/solr/core/src/java/org/apache/solr/update/DefaultSolrCoreState.java
@@ -204,14 +204,14 @@ public final class DefaultSolrCoreState extends SolrCoreState
log.debug("Closing old IndexWriter... core= {}", coreName);
iw.close();
} catch (Exception e) {
- SolrException.log(log, "Error closing old IndexWriter. core=" + coreName, e);
+ log.error("Error closing old IndexWriter. core={}", coreName, e);
}
} else {
try {
log.debug("Rollback old IndexWriter... core={}", coreName);
iw.rollback();
} catch (Exception e) {
- SolrException.log(log, "Error rolling back old IndexWriter. core=" + coreName, e);
+ log.error("Error rolling back old IndexWriter. core={}", coreName, e);
}
}
}
diff --git a/solr/core/src/java/org/apache/solr/update/DirectUpdateHandler2.java b/solr/core/src/java/org/apache/solr/update/DirectUpdateHandler2.java
index 1d5339f26d7..772779a1926 100644
--- a/solr/core/src/java/org/apache/solr/update/DirectUpdateHandler2.java
+++ b/solr/core/src/java/org/apache/solr/update/DirectUpdateHandler2.java
@@ -812,7 +812,7 @@ public class DirectUpdateHandler2 extends UpdateHandler
try {
waitSearcher[0].get();
} catch (InterruptedException | ExecutionException e) {
- SolrException.log(log, e);
+ log.error("Exception waiting for searcher", e);
}
}
}
diff --git a/solr/core/src/java/org/apache/solr/update/SolrCmdDistributor.java b/solr/core/src/java/org/apache/solr/update/SolrCmdDistributor.java
index af5dcaf4649..b7687d4eb1b 100644
--- a/solr/core/src/java/org/apache/solr/update/SolrCmdDistributor.java
+++ b/solr/core/src/java/org/apache/solr/update/SolrCmdDistributor.java
@@ -170,36 +170,24 @@ public class SolrCmdDistributor implements Closeable {
this.errors.clear();
for (SolrError err : resubmitList) {
if (err.req.node instanceof ForwardNode) {
- SolrException.log(
- SolrCmdDistributor.log,
- "forwarding update to "
- + err.req.node.getUrl()
- + " failed - retrying ... retries: "
- + err.req.retries
- + "/"
- + err.req.node.getMaxRetries()
- + ". "
- + err.req.cmd.toString()
- + " params:"
- + err.req.uReq.getParams()
- + " rsp:"
- + err.statusCode,
+ SolrCmdDistributor.log.error(
+ "forwarding update to {} failed - retrying ... retries: {}/{}. {} params: {} rsp: {}",
+ err.req.node.getUrl(),
+ err.req.retries,
+ err.req.node.getMaxRetries(),
+ err.req.cmd,
+ err.req.uReq.getParams(),
+ err.statusCode,
err.e);
} else {
- SolrException.log(
- SolrCmdDistributor.log,
- "FROMLEADER request to "
- + err.req.node.getUrl()
- + " failed - retrying ... retries: "
- + err.req.retries
- + "/"
- + err.req.node.getMaxRetries()
- + ". "
- + err.req.cmd.toString()
- + " params:"
- + err.req.uReq.getParams()
- + " rsp:"
- + err.statusCode,
+ SolrCmdDistributor.log.error(
+ "FROMLEADER request to {} failed - retrying ... retries: {}/{}. {} params: {} rsp: {}",
+ err.req.node.getUrl(),
+ err.req.retries,
+ err.req.node.getMaxRetries(),
+ err.req.cmd,
+ err.req.uReq.getParams(),
+ err.statusCode,
err.e);
}
submit(err.req, false);
@@ -341,7 +329,7 @@ public class SolrCmdDistributor implements Closeable {
req.uReq.setBasePath(req.node.getUrl());
clients.getHttpClient().request(req.uReq);
} catch (Exception e) {
- SolrException.log(log, e);
+ log.error("Exception making request", e);
SolrError error = new SolrError();
error.e = e;
error.req = req;
@@ -383,7 +371,7 @@ public class SolrCmdDistributor implements Closeable {
SolrClient solrClient = clients.getSolrClient(req);
solrClient.request(req.uReq);
} catch (Exception e) {
- SolrException.log(log, e);
+ log.error("Exception making request", e);
SolrError error = new SolrError();
error.e = e;
error.req = req;
diff --git a/solr/core/src/java/org/apache/solr/update/UpdateLog.java b/solr/core/src/java/org/apache/solr/update/UpdateLog.java
index ae12fe9a3b8..1b29405f747 100644
--- a/solr/core/src/java/org/apache/solr/update/UpdateLog.java
+++ b/solr/core/src/java/org/apache/solr/update/UpdateLog.java
@@ -742,7 +742,7 @@ public class UpdateLog implements PluginInfoInitialized, SolrMetricProducer {
RefCounted<SolrIndexSearcher> holder = uhandler.core.openNewSearcher(true, true);
holder.decref();
} catch (Exception e) {
- SolrException.log(log, "Error opening realtime searcher", e);
+ log.error("Error opening realtime searcher", e);
return;
}
@@ -759,7 +759,7 @@ public class UpdateLog implements PluginInfoInitialized, SolrMetricProducer {
RefCounted<SolrIndexSearcher> holder = uhandler.core.openNewSearcher(true, true);
holder.decref();
} catch (Exception e) {
- SolrException.log(log, "Error opening realtime searcher for deleteByQuery", e);
+ log.error("Error opening realtime searcher for deleteByQuery", e);
}
if (map != null) map.clear();
@@ -1487,7 +1487,7 @@ public class UpdateLog implements PluginInfoInitialized, SolrMetricProducer {
try {
ExecutorUtil.shutdownAndAwaitTermination(recoveryExecutor);
} catch (Exception e) {
- SolrException.log(log, e);
+ log.error("Exception shutting down recoveryExecutor", e);
}
}
@@ -1875,15 +1875,15 @@ public class UpdateLog implements PluginInfoInitialized, SolrMetricProducer {
}
} catch (SolrException e) {
if (e.code() == ErrorCode.SERVICE_UNAVAILABLE.code) {
- SolrException.log(log, e);
+ log.error("Replay failed service unavailable", e);
recoveryInfo.failed = true;
} else {
recoveryInfo.errors.incrementAndGet();
- SolrException.log(log, e);
+ log.error("Replay failed due to exception", e);
}
} catch (Exception e) {
recoveryInfo.errors.incrementAndGet();
- SolrException.log(log, e);
+ log.error("Replay failed due to exception", e);
} finally {
// change the state while updates are still blocked to prevent races
state = State.ACTIVE;
@@ -2004,7 +2004,7 @@ public class UpdateLog implements PluginInfoInitialized, SolrMetricProducer {
}
}
} catch (Exception e) {
- SolrException.log(log, e);
+ log.error("Exception during replay", e);
}
if (o == null) break;
diff --git a/solr/core/src/java/org/apache/solr/update/processor/FieldMutatingUpdateProcessor.java b/solr/core/src/java/org/apache/solr/update/processor/FieldMutatingUpdateProcessor.java
index 4fb6bf2f126..8593294b6f2 100644
--- a/solr/core/src/java/org/apache/solr/update/processor/FieldMutatingUpdateProcessor.java
+++ b/solr/core/src/java/org/apache/solr/update/processor/FieldMutatingUpdateProcessor.java
@@ -91,7 +91,7 @@ public abstract class FieldMutatingUpdateProcessor extends UpdateRequestProcesso
dest = mutate(src);
} catch (SolrException e) {
String msg = "Unable to mutate field '" + fname + "': " + e.getMessage();
- SolrException.log(log, msg, e);
+ log.error(msg, e);
throw new SolrException(BAD_REQUEST, msg, e);
}
if (null == dest) {
diff --git a/solr/core/src/java/org/apache/solr/update/processor/UpdateRequestProcessor.java b/solr/core/src/java/org/apache/solr/update/processor/UpdateRequestProcessor.java
index d35303b8cba..b8654d9102a 100644
--- a/solr/core/src/java/org/apache/solr/update/processor/UpdateRequestProcessor.java
+++ b/solr/core/src/java/org/apache/solr/update/processor/UpdateRequestProcessor.java
@@ -20,7 +20,6 @@ import java.io.Closeable;
import java.io.IOException;
import java.lang.invoke.MethodHandles;
import net.jcip.annotations.NotThreadSafe;
-import org.apache.solr.common.SolrException;
import org.apache.solr.update.AddUpdateCommand;
import org.apache.solr.update.CommitUpdateCommand;
import org.apache.solr.update.DeleteUpdateCommand;
@@ -86,7 +85,7 @@ public abstract class UpdateRequestProcessor implements Closeable {
try {
p.doClose();
} catch (Exception e) {
- SolrException.log(log, "Exception closing processor", e);
+ log.error("Exception closing processor", e);
}
p = p.next;
}
diff --git a/solr/core/src/test/org/apache/solr/search/TestFiltering.java b/solr/core/src/test/org/apache/solr/search/TestFiltering.java
index 1d44ac2943f..e6326508037 100644
--- a/solr/core/src/test/org/apache/solr/search/TestFiltering.java
+++ b/solr/core/src/test/org/apache/solr/search/TestFiltering.java
@@ -24,7 +24,6 @@ import org.apache.lucene.search.DocIdSetIterator;
import org.apache.lucene.search.Query;
import org.apache.lucene.util.FixedBitSet;
import org.apache.solr.SolrTestCaseJ4;
-import org.apache.solr.common.SolrException;
import org.apache.solr.common.SolrInputDocument;
import org.apache.solr.common.params.SolrParams;
import org.apache.solr.request.SolrQueryRequest;
@@ -564,7 +563,6 @@ public class TestFiltering extends SolrTestCaseJ4 {
facet ? "/facet_counts/facet_queries/facetQuery/==" + expectedFacetQuery : null);
} catch (Exception e) {
// show the indexIter and queryIter for easier debugging
- SolrException.log(log, e);
String s =
"FAILURE: indexSize="
+ model.indexSize
@@ -574,7 +572,7 @@ public class TestFiltering extends SolrTestCaseJ4 {
+ qiter
+ " request="
+ params;
- log.error(s);
+ log.error(s, e);
fail(s);
}
}
diff --git a/solr/modules/hdfs/src/java/org/apache/solr/hdfs/update/HdfsUpdateLog.java b/solr/modules/hdfs/src/java/org/apache/solr/hdfs/update/HdfsUpdateLog.java
index dfe7944a15a..cca223ba850 100644
--- a/solr/modules/hdfs/src/java/org/apache/solr/hdfs/update/HdfsUpdateLog.java
+++ b/solr/modules/hdfs/src/java/org/apache/solr/hdfs/update/HdfsUpdateLog.java
@@ -189,11 +189,11 @@ public class HdfsUpdateLog extends UpdateLog {
Path f = new Path(hdfsTlogDir, oldLogName);
try {
oldLog = new HdfsTransactionLog(fs, f, null, true, tlogDfsReplication);
- addOldLog(oldLog, false); // don't remove old logs on startup since more
- // than one may be uncapped.
+ // don't remove old logs on startup since more than one may be uncapped.
+ addOldLog(oldLog, false);
} catch (Exception e) {
INIT_FAILED_LOGS_COUNT.incrementAndGet();
- SolrException.log(log, "Failure to open existing log file (non fatal) " + f, e);
+ log.error("Failure to open existing log file (non fatal) {}", f, e);
try {
fs.delete(f, false);
} catch (IOException e1) {
@@ -428,7 +428,7 @@ public class HdfsUpdateLog extends UpdateLog {
// state = State.ACTIVE;
// operationFlags &= ~FLAG_GAP;
// } catch (IOException e) {
- // SolrException.log(log,"Error attempting to roll back log", e);
+ // log.error("Error attempting to roll back log", e);
// return false;
// }
// finally {
diff --git a/solr/modules/sql/src/java/org/apache/solr/handler/sql/SQLHandler.java b/solr/modules/sql/src/java/org/apache/solr/handler/sql/SQLHandler.java
index 1870d21824d..1f3cfe6b05d 100644
--- a/solr/modules/sql/src/java/org/apache/solr/handler/sql/SQLHandler.java
+++ b/solr/modules/sql/src/java/org/apache/solr/handler/sql/SQLHandler.java
@@ -31,7 +31,6 @@ import org.apache.solr.client.solrj.io.Tuple;
import org.apache.solr.client.solrj.io.comp.StreamComparator;
import org.apache.solr.client.solrj.io.stream.ExceptionStream;
import org.apache.solr.client.solrj.io.stream.TupleStream;
-import org.apache.solr.common.SolrException;
import org.apache.solr.common.params.CommonParams;
import org.apache.solr.common.params.ModifiableSolrParams;
import org.apache.solr.common.params.SolrParams;
@@ -130,7 +129,7 @@ public class SQLHandler extends RequestHandlerBase
if (tupleStream != null) {
tupleStream.close();
}
- SolrException.log(log, e);
+ log.error("Exception while SQL parsing and query transformation", e);
rsp.add("result-set", new StreamHandler.DummyErrorStream(e));
}
}
diff --git a/solr/solrj-streaming/src/java/org/apache/solr/client/solrj/io/stream/ExceptionStream.java b/solr/solrj-streaming/src/java/org/apache/solr/client/solrj/io/stream/ExceptionStream.java
index f6dec46bdf0..e4a6f425dc7 100644
--- a/solr/solrj-streaming/src/java/org/apache/solr/client/solrj/io/stream/ExceptionStream.java
+++ b/solr/solrj-streaming/src/java/org/apache/solr/client/solrj/io/stream/ExceptionStream.java
@@ -25,7 +25,6 @@ import org.apache.solr.client.solrj.io.stream.expr.Explanation;
import org.apache.solr.client.solrj.io.stream.expr.Explanation.ExpressionType;
import org.apache.solr.client.solrj.io.stream.expr.StreamExplanation;
import org.apache.solr.client.solrj.io.stream.expr.StreamFactory;
-import org.apache.solr.common.SolrException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -59,15 +58,14 @@ public class ExceptionStream extends TupleStream {
@Override
public Tuple read() {
if (openException != null) {
- // There was an exception during the open.
- SolrException.log(log, openException);
+ log.error("Exception while opening the stream", openException);
return Tuple.EXCEPTION(openException.getMessage(), true);
}
try {
return stream.read();
} catch (Exception e) {
- SolrException.log(log, e);
+ log.error("Exception while reading the stream", e);
return Tuple.EXCEPTION(e.getMessage(), true);
}
}
diff --git a/solr/solrj-zookeeper/src/java/org/apache/solr/common/cloud/ConnectionManager.java b/solr/solrj-zookeeper/src/java/org/apache/solr/common/cloud/ConnectionManager.java
index a437a6bdf00..ba527b1eef8 100644
--- a/solr/solrj-zookeeper/src/java/org/apache/solr/common/cloud/ConnectionManager.java
+++ b/solr/solrj-zookeeper/src/java/org/apache/solr/common/cloud/ConnectionManager.java
@@ -223,8 +223,7 @@ public class ConnectionManager implements Watcher {
break;
} catch (Exception e) {
- SolrException.log(log, "", e);
- log.info("Could not connect due to error, sleeping for 1s and trying again");
+ log.error("Could not connect due to error, sleeping for 1s and trying again", e);
waitSleep(1000);
}
diff --git a/solr/solrj-zookeeper/src/java/org/apache/solr/common/cloud/SolrZkClient.java b/solr/solrj-zookeeper/src/java/org/apache/solr/common/cloud/SolrZkClient.java
index bafa7f4a6ad..b8691cac5cd 100644
--- a/solr/solrj-zookeeper/src/java/org/apache/solr/common/cloud/SolrZkClient.java
+++ b/solr/solrj-zookeeper/src/java/org/apache/solr/common/cloud/SolrZkClient.java
@@ -834,13 +834,13 @@ public class SolrZkClient implements Closeable {
try {
ExecutorUtil.shutdownAndAwaitTermination(zkCallbackExecutor);
} catch (Exception e) {
- SolrException.log(log, e);
+ log.error("Error shutting down zkCallbackExecutor", e);
}
try {
ExecutorUtil.shutdownAndAwaitTermination(zkConnManagerCallbackExecutor);
} catch (Exception e) {
- SolrException.log(log, e);
+ log.error("Error shutting down zkConnManagerCallbackExecutor", e);
}
}
diff --git a/solr/solrj-zookeeper/src/java/org/apache/solr/common/cloud/ZkClientConnectionStrategy.java b/solr/solrj-zookeeper/src/java/org/apache/solr/common/cloud/ZkClientConnectionStrategy.java
index 47776b4eaaf..8102606a59b 100644
--- a/solr/solrj-zookeeper/src/java/org/apache/solr/common/cloud/ZkClientConnectionStrategy.java
+++ b/solr/solrj-zookeeper/src/java/org/apache/solr/common/cloud/ZkClientConnectionStrategy.java
@@ -21,7 +21,6 @@ import java.lang.invoke.MethodHandles;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.TimeoutException;
-import org.apache.solr.common.SolrException;
import org.apache.solr.common.cloud.ZkCredentialsProvider.ZkCredentials;
import org.apache.zookeeper.Watcher;
import org.apache.zookeeper.ZooKeeper;
@@ -55,7 +54,7 @@ public abstract class ZkClientConnectionStrategy {
try {
listener.disconnected();
} catch (Exception e) {
- SolrException.log(log, "", e);
+ log.error("Exception on disconnected for listener: {}", listener, e);
}
}
}
@@ -65,7 +64,7 @@ public abstract class ZkClientConnectionStrategy {
try {
listener.connected();
} catch (Exception e) {
- SolrException.log(log, "", e);
+ log.error("Exception on connected for listener: {}", listener, e);
}
}
}
diff --git a/solr/solrj/src/java/org/apache/solr/common/SolrException.java b/solr/solrj/src/java/org/apache/solr/common/SolrException.java
index 6b99259fc8c..2b6fae56063 100644
--- a/solr/solrj/src/java/org/apache/solr/common/SolrException.java
+++ b/solr/solrj/src/java/org/apache/solr/common/SolrException.java
@@ -18,6 +18,7 @@ package org.apache.solr.common;
import java.util.Map;
import org.apache.solr.common.util.NamedList;
+import org.apache.solr.common.util.SuppressForbidden;
import org.slf4j.Logger;
import org.slf4j.MDC;
@@ -139,6 +140,7 @@ public class SolrException extends RuntimeException {
* @deprecated Use the Logger directly
*/
@Deprecated
+ @SuppressForbidden(reason = "self referencing")
public void log(Logger log) {
log(log, this);
}
diff --git a/solr/test-framework/src/java/org/apache/solr/SolrTestCaseHS.java b/solr/test-framework/src/java/org/apache/solr/SolrTestCaseHS.java
index d721d37dab1..e33413efabb 100644
--- a/solr/test-framework/src/java/org/apache/solr/SolrTestCaseHS.java
+++ b/solr/test-framework/src/java/org/apache/solr/SolrTestCaseHS.java
@@ -43,7 +43,6 @@ import org.apache.solr.client.solrj.request.QueryRequest;
import org.apache.solr.client.solrj.request.UpdateRequest;
import org.apache.solr.client.solrj.response.DelegationTokenResponse;
import org.apache.solr.client.solrj.response.UpdateResponse;
-import org.apache.solr.common.SolrException;
import org.apache.solr.common.SolrInputDocument;
import org.apache.solr.common.params.ModifiableSolrParams;
import org.apache.solr.common.params.SolrParams;
@@ -177,7 +176,7 @@ public class SolrTestCaseHS extends SolrTestCaseJ4 {
} catch (XPathExpressionException e1) {
throw new RuntimeException("XPath is invalid", e1);
} catch (Exception e2) {
- SolrException.log(log, "REQUEST FAILED for params: " + args.toQueryString(), e2);
+ log.error("REQUEST FAILED for params: {}", args.toQueryString(), e2);
throw new RuntimeException("Exception during query", e2);
}
}
diff --git a/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java b/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java
index 7438fcbe69a..47e0b473fb9 100644
--- a/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java
+++ b/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java
@@ -1020,7 +1020,7 @@ public abstract class SolrTestCaseJ4 extends SolrTestCase {
} catch (XPathExpressionException e1) {
throw new RuntimeException("XPath is invalid", e1);
} catch (Exception e2) {
- SolrException.log(log, "REQUEST FAILED: " + req.getParamString(), e2);
+ log.error("REQUEST FAILED: {}", req.getParamString(), e2);
throw new RuntimeException("Exception during query", e2);
}
}
diff --git a/solr/test-framework/src/java/org/apache/solr/util/RestTestBase.java b/solr/test-framework/src/java/org/apache/solr/util/RestTestBase.java
index 29de96c7ac8..b3e8b3a7e4a 100644
--- a/solr/test-framework/src/java/org/apache/solr/util/RestTestBase.java
+++ b/solr/test-framework/src/java/org/apache/solr/util/RestTestBase.java
@@ -23,7 +23,6 @@ import java.util.SortedMap;
import javax.xml.xpath.XPathExpressionException;
import org.apache.solr.JSONTestUtil;
import org.apache.solr.SolrJettyTestBase;
-import org.apache.solr.common.SolrException;
import org.apache.solr.common.params.MultiMapSolrParams;
import org.apache.solr.common.util.StrUtils;
import org.apache.solr.servlet.SolrRequestParsers;
@@ -147,7 +146,7 @@ public abstract class RestTestBase extends SolrJettyTestBase {
} catch (XPathExpressionException e1) {
throw new RuntimeException("XPath is invalid", e1);
} catch (Exception e2) {
- SolrException.log(log, "REQUEST FAILED: " + request, e2);
+ log.error("REQUEST FAILED: {}", request, e2);
throw new RuntimeException("Exception during query", e2);
}
}