Skip to content

Commit 36e9e10

Browse files
committed
refactor(log):downgrade certain log level in some files
1 parent c0955d7 commit 36e9e10

5 files changed

Lines changed: 17 additions & 16 deletions

File tree

chainbase/src/main/java/org/tron/core/capsule/TransactionCapsule.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -333,13 +333,13 @@ public static byte[] getOwner(Transaction.Contract contract) {
333333
Class<? extends GeneratedMessageV3> clazz = TransactionFactory
334334
.getContract(contract.getType());
335335
if (clazz == null) {
336-
logger.error("not exist {}", contract.getType());
336+
logger.warn("not exist {}", contract.getType());
337337
return new byte[0];
338338
}
339339
GeneratedMessageV3 generatedMessageV3 = contractParameter.unpack(clazz);
340340
owner = ReflectUtils.getFieldValue(generatedMessageV3, OWNER_ADDRESS);
341341
if (owner == null) {
342-
logger.error("not exist [{}] field,{}", OWNER_ADDRESS, clazz);
342+
logger.warn("not exist [{}] field,{}", OWNER_ADDRESS, clazz);
343343
return new byte[0];
344344
}
345345
break;

framework/src/main/java/org/tron/core/Wallet.java

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@
110110
import org.tron.common.utils.ByteUtil;
111111
import org.tron.common.utils.DecodeUtil;
112112
import org.tron.common.utils.Sha256Hash;
113+
import org.tron.common.utils.StringUtil;
113114
import org.tron.common.utils.Utils;
114115
import org.tron.common.utils.WalletUtil;
115116
import org.tron.common.zksnark.IncrementalMerkleTreeContainer;
@@ -583,7 +584,7 @@ public GrpcAPI.Return broadcastTransaction(Transaction signedTransaction) {
583584
.setMessage(ByteString.copyFromUtf8("Transaction expired"))
584585
.build();
585586
} catch (Exception e) {
586-
logger.error(BROADCAST_TRANS_FAILED, txID, e.getMessage());
587+
logger.warn("Broadcast transaction {} failed", txID, e);
587588
return builder.setResult(false).setCode(response_code.OTHER_ERROR)
588589
.setMessage(ByteString.copyFromUtf8("Error: " + e.getMessage()))
589590
.build();
@@ -1708,7 +1709,7 @@ public Proposal getProposalById(ByteString proposalId) {
17081709
proposalCapsule = chainBaseManager.getProposalStore()
17091710
.get(proposalId.toByteArray());
17101711
} catch (StoreException e) {
1711-
logger.error(e.getMessage());
1712+
logger.warn(e.getMessage());
17121713
}
17131714
if (proposalCapsule != null) {
17141715
return proposalCapsule.getInstance();
@@ -2626,7 +2627,7 @@ public TransactionInfoList getTransactionInfoByBlockNum(long blockNum) {
26262627
}
26272628
}
26282629
} catch (BadItemException | ItemNotFoundException e) {
2629-
logger.error(e.getMessage());
2630+
logger.warn(e.getMessage());
26302631
}
26312632

26322633
return transactionInfoList.build();
@@ -2658,7 +2659,7 @@ public MarketOrder getMarketOrderById(ByteString orderId) {
26582659
try {
26592660
return marketOrderStore.get(orderId.toByteArray()).getInstance();
26602661
} catch (ItemNotFoundException e) {
2661-
logger.error("orderId = " + orderId.toString() + " not found");
2662+
logger.warn("orderId = {} not found", orderId);
26622663
throw new IllegalStateException("order not found in store");
26632664
}
26642665

@@ -2694,7 +2695,7 @@ public MarketOrderList getMarketOrderByAccount(ByteString accountAddress) {
26942695
marketOrderListBuilder
26952696
.addOrders(orderCapsule.getInstance());
26962697
} catch (ItemNotFoundException e) {
2697-
logger.error("orderId = " + orderId.toString() + " not found");
2698+
logger.warn("orderId = {} not found", orderId);
26982699
throw new IllegalStateException("order not found in store");
26992700
}
27002701
}
@@ -3061,9 +3062,9 @@ public SmartContract getContract(GrpcAPI.BytesMessage bytesMessage) {
30613062
byte[] address = bytesMessage.getValue().toByteArray();
30623063
AccountCapsule accountCapsule = chainBaseManager.getAccountStore().get(address);
30633064
if (accountCapsule == null) {
3064-
logger.error(
3065-
"Get contract failed, the account does not exist or the account "
3066-
+ "does not have a code hash!");
3065+
logger.warn(
3066+
"Get contract failed, the account {} does not exist or the account "
3067+
+ "does not have a code hash!", StringUtil.encode58Check(address));
30673068
return null;
30683069
}
30693070

@@ -3090,9 +3091,9 @@ public SmartContractDataWrapper getContractInfo(GrpcAPI.BytesMessage bytesMessag
30903091
byte[] address = bytesMessage.getValue().toByteArray();
30913092
AccountCapsule accountCapsule = chainBaseManager.getAccountStore().get(address);
30923093
if (accountCapsule == null) {
3093-
logger.error(
3094-
"Get contract failed, the account does not exist or the account does not have a code "
3095-
+ "hash!");
3094+
logger.warn(
3095+
"Get contract failed, the account {} does not exist or the account does not have a code "
3096+
+ "hash!", StringUtil.encode58Check(address));
30963097
return null;
30973098
}
30983099

framework/src/main/java/org/tron/core/db/Manager.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1609,7 +1609,7 @@ public BlockCapsule generateBlock(Miner miner, long blockTime, long timeout) {
16091609
toBePacked.add(trx);
16101610
currentSize += trxPackSize;
16111611
} catch (Exception e) {
1612-
logger.error("Process trx {} failed when generating block {}, {}.", trx.getTransactionId(),
1612+
logger.warn("Process trx {} failed when generating block {}, {}.", trx.getTransactionId(),
16131613
blockCapsule.getNum(), e.getMessage());
16141614
}
16151615
}

framework/src/main/java/org/tron/core/services/http/Util.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ public static Transaction packTransaction(String strTransaction, boolean selfTyp
303303
} catch (JSONException e) {
304304
logger.debug("JSONException: {}", e.getMessage());
305305
} catch (Exception e) {
306-
logger.error("", e);
306+
logger.warn("{}", contractType, e);
307307
}
308308
}
309309
rawData.put("contract", contracts);

framework/src/main/java/org/tron/core/services/jsonrpc/JsonRpcApiUtil.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ public static long getAmountFromTransactionInfo(String hash, ContractType contra
338338
break;
339339
}
340340
} else {
341-
logger.error("Can't find transaction {} ", hash);
341+
logger.warn("Can't find transaction {} ", hash);
342342
}
343343
} catch (Exception e) {
344344
logger.warn("Exception happens when get amount from transactionInfo. Exception = [{}]",

0 commit comments

Comments
 (0)