Skip to content

Commit

Permalink
Number of placeholder doesn't match number of arguments in logging (a…
Browse files Browse the repository at this point in the history
  • Loading branch information
yjshen authored Mar 27, 2020
1 parent d001094 commit 988e03e
Show file tree
Hide file tree
Showing 36 changed files with 46 additions and 46 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ public void operationComplete(MLDataFormats.ManagedLedgerInfo mlInfo, Stat stat)
final long id = ledgers.lastKey();
AsyncCallback.OpenCallback opencb = (rc, lh, ctx1) -> {
if (log.isDebugEnabled()) {
log.debug("[{}] Opened ledger {}: ", managedLedgerName, id,
log.debug("[{}] Opened ledger {}: {}", managedLedgerName, id,
BKException.getMessage(rc));
}
if (rc == BKException.Code.OK) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public ReadOnlyCursorImpl(BookKeeper bookkeeper, ManagedLedgerConfig config, Man

@Override
public void skipEntries(int numEntriesToSkip) {
log.info("[{}] Skipping {} entries on read-only cursor {}", ledger.getName(), numEntriesToSkip);
log.info("[{}] Skipping {} entries on read-only cursor {}", ledger.getName(), numEntriesToSkip, getName());
READ_POSITION_UPDATER.getAndUpdate(this, lastRead ->
ledger.getPositionAfterN(lastRead, numEntriesToSkip, PositionBound.startIncluded).getNext());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public void initialize(ServiceConfiguration config) throws IOException {
new PulsarSaslServer.SaslServerCallbackHandler(allowedIdsPattern),
configuration);
} catch (LoginException e) {
log.error("JAAS login in broker failed: {}" , e);
log.error("JAAS login in broker failed" , e);
throw new IOException(e);
}
}
Expand Down Expand Up @@ -125,7 +125,7 @@ public AuthenticationState newAuthState(AuthData authData,
new SaslAuthenticationDataSource(
new PulsarSaslServer(jaasCredentialsContainer.getSubject(), allowedIdsPattern)));
} catch (Throwable t) {
log.error("Failed create sasl auth state: {}" , t);
log.error("Failed create sasl auth state" , t);
throw new AuthenticationException(t.getMessage());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public void removeTransactionMetadataStore(TransactionCoordinatorID tcId) {
if (metadataStore != null) {
metadataStore.closeAsync().whenComplete((v, ex) -> {
if (ex != null) {
LOG.error("Close transaction metadata store with id {} error", ex);
LOG.error("Close transaction metadata store with id " + tcId, ex);
} else {
LOG.info("Removed and closed transaction meta store {}", tcId);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ protected Map<Long, Collection<ResourceUnit>> internalBrokerResourceAvailability
throw new RestException(Status.CONFLICT, lm.getClass().getName() + " does not support this operation");
}
} catch (Exception e) {
log.error("Unable to get Resource Availability - [{}]", e);
log.error("Unable to get Resource Availability", e);
throw new RestException(e);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ public void stop() {
try {
pulsar.getLocalZkCache().getZooKeeper().delete(ELECTION_ROOT, -1);
} catch (Throwable t) {
log.warn("Failed to cleanup election root znode: {}", t);
log.warn("Failed to cleanup election root znode", t);
}
}
stopped = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public void run() {
try {
loadManager.get().writeLoadReportOnZookeeper();
} catch (Exception e) {
LOG.warn("Unable to write load report on Zookeeper - [{}]", e);
LOG.warn("Unable to write load report on Zookeeper", e);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public static void applyNamespacePolicies(final ServiceUnitId serviceUnit,
try {
brokerUrl = new URL(brokerUrlString);
} catch (MalformedURLException e) {
log.error("Unable to parse brokerUrl from ResourceUnitId - [{}]", e);
log.error("Unable to parse brokerUrl from ResourceUnitId", e);
continue;
}
// todo: in future check if the resource unit has resources to take the namespace
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -852,7 +852,7 @@ public LocalBrokerData updateLocalBrokerData() {
final SystemResourceUsage systemResourceUsage = LoadManagerShared.getSystemResourceUsage(brokerHostUsage);
localData.update(systemResourceUsage, getBundleStats());
} catch (Exception e) {
log.warn("Error when attempting to update local broker data: {}", e);
log.warn("Error when attempting to update local broker data", e);
}
return localData;
}
Expand Down Expand Up @@ -882,7 +882,7 @@ public void writeBrokerDataOnZooKeeper() {
lastData.update(localData);
}
} catch (Exception e) {
log.warn("Error writing broker data on ZooKeeper: {}", e);
log.warn("Error writing broker data on ZooKeeper", e);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public static LoadReport parse(String loadReportJson) {
pulsarLoadReport.resourceDescription);

} catch (Exception e) {
log.warn("Failed Parsing Load Report from JSON string [{}]", e);
log.warn("Failed Parsing Load Report from JSON string", e);
}
return pulsarLoadReport;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ public void start() throws PulsarServerException {
loadReport = generateLoadReport();
this.lastResourceUsageTimestamp = loadReport.getTimestamp();
} catch (Exception e) {
log.warn("Unable to get load report to write it on zookeeper [{}]", e);
log.warn("Unable to get load report to write it on zookeeper", e);
}
String loadReportJson = "";
if (loadReport != null) {
Expand Down Expand Up @@ -927,7 +927,7 @@ private Multimap<Long, ResourceUnit> getFinalCandidates(ServiceUnitId serviceUni
LoadManagerShared.applyNamespacePolicies(serviceUnit, policies, brokerCandidateCache,
availableBrokersCache, brokerTopicLoadingPredicate);
} catch (Exception e) {
log.warn("Error when trying to apply policies: {}", e);
log.warn("Error when trying to apply policies", e);
for (final Map.Entry<Long, Set<ResourceUnit>> entry : availableBrokers.entrySet()) {
result.putAll(entry.getKey(), entry.getValue());
}
Expand Down Expand Up @@ -1060,7 +1060,7 @@ private void updateRanking() {
doLoadRanking();
}
} catch (Exception e) {
log.warn("Error reading active brokers list from zookeeper while re-ranking load reports [{}]", e);
log.warn("Error reading active brokers list from zookeeper while re-ranking load reports", e);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ private Optional<NamespaceIsolationPolicies> getIsolationPolicies(String cluster
return namespaceIsolationPolicies
.get(AdminResource.path("clusters", clusterName, NAMESPACE_ISOLATION_POLICIES));
} catch (Exception e) {
LOG.warn("GetIsolationPolicies: Unable to get the namespaceIsolationPolicies [{}]", e);
LOG.warn("GetIsolationPolicies: Unable to get the namespaceIsolationPolicies", e);
return Optional.empty();
}
}
Expand All @@ -68,7 +68,7 @@ public boolean areIsolationPoliciesPresent(NamespaceName namespace) {
return false;
}
} catch (Exception e) {
LOG.warn("IsIsolationPoliciesPresent: Unable to get the namespaceIsolationPolicies [{}]", e);
LOG.warn("IsIsolationPoliciesPresent: Unable to get the namespaceIsolationPolicies", e);
return false;
}
}
Expand All @@ -82,7 +82,7 @@ private Optional<NamespaceIsolationPolicy> getNamespaceIsolationPolicy(Namespace

return Optional.ofNullable(policies.get().getPolicyByNamespace(namespace));
} catch (Exception e) {
LOG.warn("Unable to get the namespaceIsolationPolicies [{}]", e);
LOG.warn("Unable to get the namespaceIsolationPolicies", e);
return Optional.empty();
}
}
Expand All @@ -106,7 +106,7 @@ public boolean isSharedBroker(String broker) {

return policies.get().isSharedBroker(broker);
} catch (Exception e) {
LOG.warn("isPrimaryForAnyNamespace: [{}]", e);
LOG.warn("isPrimaryForAnyNamespace", e);
}
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1966,7 +1966,7 @@ public void checkUnAckMessageDispatching() {
long unAckedMessages = totalUnackedMessages.sum();
if (unAckedMessages >= maxUnackedMessages && blockedDispatcherOnHighUnackedMsgs.compareAndSet(false, true)) {
// block dispatcher with higher unack-msg when it reaches broker-unack msg limit
log.info("[{}] Starting blocking dispatchers with unacked msgs {} due to reached max broker limit {}",
log.info("Starting blocking dispatchers with unacked msgs {} due to reached max broker limit {}",
maxUnackedMessages, maxUnackedMsgsPerDispatcher);
executor().execute(() -> blockDispatchersWithLargeUnAckMessages());
} else if (blockedDispatcherOnHighUnackedMsgs.get() && unAckedMessages < maxUnackedMessages / 2) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public NonPersistentDispatcherMultipleConsumers(NonPersistentTopic topic, Subscr
@Override
public synchronized void addConsumer(Consumer consumer) throws BrokerServiceException {
if (IS_CLOSED_UPDATER.get(this) == TRUE) {
log.warn("[{}] Dispatcher is already closed. Closing consumer ", name, consumer);
log.warn("[{}] Dispatcher is already closed. Closing consumer {}", name, consumer);
consumer.disconnect();
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1131,7 +1131,7 @@ public void markDeleteComplete(Object ctx) {
@Override
public void markDeleteFailed(ManagedLedgerException exception, Object ctx) {
if (log.isDebugEnabled()) {
log.debug("[{}][{}] Failed to mark delete for position ", topicName, subName, ctx, exception);
log.debug("[{}][{}] Failed to mark delete for position {} due to: {}", topicName, subName, ctx, exception);
}
marketDeleteFuture.completeExceptionally(exception);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public AuthenticationDataProvider getAuthData(String serverHostname) throws Puls
PulsarSaslClient saslClient = new PulsarSaslClient(serverHostname, serverType, jaasCredentialsContainer.getSubject());
return new SaslAuthenticationDataProvider(saslClient);
} catch (Throwable t) {
log.error("Failed create sasl client: {}", t);
log.error("Failed create sasl client", t);
throw new PulsarClientException(t);
}
}
Expand Down Expand Up @@ -151,7 +151,7 @@ private void setAuthParams(Map<String, String> authParams) throws PulsarClientEx
configuration);
initializedJAAS = true;
} catch (LoginException e) {
log.error("JAAS login in client failed: {}" , e);
log.error("JAAS login in client failed" , e);
throw new PulsarClientException(e);
}
}
Expand Down Expand Up @@ -333,7 +333,7 @@ public void completed(Response response) {

@Override
public void failed(Throwable throwable) {
log.warn("Failed to perform http request: {}", throwable);
log.warn("Failed to perform http request", throwable);
authFuture.completeExceptionally(new PulsarClientException(throwable));
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,15 +268,15 @@ public void close() {
try {
producer.close();
} catch (PulsarClientException e) {
log.warn("Failed to close producer for {}", topic, e.getMessage());
log.warn("Failed to close producer for {}: {}", topic, e.getMessage());
}
});
}
if (client != null) {
try {
client.close();
} catch (PulsarClientException e) {
log.warn("Failed to close pulsar-client {}", e.getMessage());
log.warn("Failed to close pulsar-client", e);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ private void init(ConsumerConfigurationData<?> conf) {
log.info("Starting Pulsar consumer status recorder with config: {}", w.writeValueAsString(conf));
log.info("Pulsar client config: {}", w.withoutAttribute("authentication").writeValueAsString(pulsarClient.getConfiguration()));
} catch (IOException e) {
log.error("Failed to dump config info: {}", e);
log.error("Failed to dump config info", e);
}

stat = (timeout) -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ public CompletableFuture<List<String>> getTopicsUnderNamespace(NamespaceName nam
});
future.complete(result);})
.exceptionally(ex -> {
log.warn("Failed to getTopicsUnderNamespace namespace: {}.", namespace, ex.getMessage());
log.warn("Failed to getTopicsUnderNamespace namespace {} {}.", namespace, ex.getMessage());
future.completeExceptionally(ex);
return null;
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public GenericRecord read(InputStream inputStream) {
try {
inputStream.close();
} catch (IOException e) {
log.error("GenericAvroReader close inputStream close error", e.getMessage());
log.error("GenericAvroReader close inputStream close error", e);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public GenericRecord read(InputStream inputStream) {
try {
inputStream.close();
} catch (IOException e) {
log.error("GenericJsonReader close inputStream close error", e.getMessage());
log.error("GenericJsonReader close inputStream close error", e);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public T read(InputStream inputStream) {
try {
inputStream.close();
} catch (IOException e) {
log.error("AvroReader close inputStream close error", e.getMessage());
log.error("AvroReader close inputStream close error", e);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public T read(InputStream inputStream) {
try {
inputStream.close();
} catch (IOException e) {
log.error("JsonReader close inputStream close error", e.getMessage());
log.error("JsonReader close inputStream close error", e);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public T read(InputStream inputStream) {
try {
inputStream.close();
} catch (IOException e) {
log.error("ProtobufReader close inputStream close error", e.getMessage());
log.error("ProtobufReader close inputStream close error", e);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ public class SchemaInfoTest {
+ "}";

@DataProvider(name = "schemas")
public Object[][] schemas() {
public static Object[][] schemas() {
return new Object[][] {
{
Schema.STRING.getSchemaInfo(), UTF8_SCHEMA_INFO
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public class JvmDefaultGCMetricsLogger implements JvmGCMetricsLogger {
try {
runtime = sun.management.ManagementFactoryHelper.getHotspotRuntimeMBean();
} catch (Exception e) {
log.warn("Failed to get Runtime bean", e.getMessage());
log.warn("Failed to get Runtime bean", e);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ public CompletableFuture<MessageId> sendAsync() {
.whenComplete((result, cause) -> {
if (null != cause) {
statsManager.incrSysExceptions(cause);
logger.error("Failed to publish to topic with error {}", cause);
logger.error("Failed to publish to topic with error", cause);
}
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ private void createStateTable(String tableNs, String tableName, StorageClientSet
// sure the table is created.
}
} catch (ClientException ce) {
log.warn("Encountered issue on fetching state stable metadata, re-attempting in 100 milliseconds",
log.warn("Encountered issue {} on fetching state stable metadata, re-attempting in 100 milliseconds",
ce.getMessage());
TimeUnit.MILLISECONDS.sleep(100);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,6 @@ public void start() {
public void close() {
log.info("Stopping Cluster Service Coordinator for worker {}", this.workerId);
this.executor.shutdown();
log.info("Stopped Cluster Service Coordinator for worker", this.workerId);
log.info("Stopped Cluster Service Coordinator for worker {}", this.workerId);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public void initialize() {
this.functionMetaDataTopicTailer.start();

} catch (Exception e) {
log.error("Failed to initialize meta data store: ", e.getMessage(), e);
log.error("Failed to initialize meta data store", e);
throw new RuntimeException(e);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ public void compactAssignmentTopic() {
try {
this.admin.topics().triggerCompaction(workerConfig.getFunctionAssignmentTopic());
} catch (PulsarAdminException e) {
log.error("Failed to trigger compaction {}", e);
log.error("Failed to trigger compaction", e);
executorService.schedule(() -> compactAssignmentTopic(), DEFAULT_ADMIN_API_BACKOFF_SEC,
TimeUnit.SECONDS);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ public void deregisterFunction(final String tenant,
} catch (NamespaceNotFoundException | StreamNotFoundException e) {
// ignored if the state table doesn't exist
} catch (Exception e) {
log.error("{}/{}/{} Failed to delete state table", e);
log.error("{}/{}/{} Failed to delete state table: {}", tenant, namespace, componentName, e.getMessage());
throw new RestException(Status.INTERNAL_SERVER_ERROR, e.getMessage());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public boolean process() throws IOException, InterruptedException {
// TODO:- Figure out the metrics story for connectors
consume(new TwitterRecord(tweet, config.getGuestimateTweetTime()));
} catch (Exception e) {
LOG.error("Exception thrown: {}", e);
LOG.error("Exception thrown", e);
}
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ protected void handleAuthChallenge(CommandAuthChallenge authChallenge) {
outboundChannel.writeAndFlush(request);
outboundChannel.read();
} catch (Exception e) {
log.error("Error mutual verify: {}", e);
log.error("Error mutual verify", e);
return;
}
}
Expand Down
Loading

0 comments on commit 988e03e

Please sign in to comment.