From a1c13d8ac4eaff48cbcfed3b5c2623ad04504f08 Mon Sep 17 00:00:00 2001 From: David Enyeart Date: Thu, 18 Nov 2021 16:04:56 -0500 Subject: [PATCH] Updates to endorser and gateway logging Update endorser and gateway log levels to improve troubleshooting. Signed-off-by: David Enyeart --- core/cclifecycle/lifecycle.go | 2 +- core/endorser/endorser.go | 4 +++- internal/pkg/gateway/api.go | 4 ++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/core/cclifecycle/lifecycle.go b/core/cclifecycle/lifecycle.go index d721871594e..edd9b745013 100644 --- a/core/cclifecycle/lifecycle.go +++ b/core/cclifecycle/lifecycle.go @@ -126,7 +126,7 @@ func (m *MetadataManager) Metadata(channel string, cc string, collections ...str return nil } if len(md) == 0 { - Logger.Info("Chaincode", cc, "isn't defined in channel", channel) + Logger.Warn("Chaincode", cc, "isn't defined in channel", channel) return nil } diff --git a/core/endorser/endorser.go b/core/endorser/endorser.go index a3d9d6f11cb..72cbb938a3c 100644 --- a/core/endorser/endorser.go +++ b/core/endorser/endorser.go @@ -315,6 +315,7 @@ func (e *Endorser) ProcessProposal(ctx context.Context, signedProp *pb.SignedPro up, err := UnpackProposal(signedProp) if err != nil { e.Metrics.ProposalValidationFailed.Add(1) + endorserLogger.Warnw("Failed to unpack proposal", "error", err.Error()) return &pb.ProposalResponse{Response: &pb.Response{Status: 500, Message: err.Error()}}, err } @@ -333,6 +334,7 @@ func (e *Endorser) ProcessProposal(ctx context.Context, signedProp *pb.SignedPro // 0 -- check and validate err = e.preProcess(up, channel) if err != nil { + endorserLogger.Warnw("Failed to preProcess proposal", "error", err.Error()) return &pb.ProposalResponse{Response: &pb.Response{Status: 500, Message: err.Error()}}, err } @@ -531,7 +533,7 @@ func (e *Endorser) buildChaincodeInterest(simResult *ledger.TxSimulationResults) } } - endorserLogger.Info("ccInterest", ccInterest) + endorserLogger.Debug("ccInterest", ccInterest) return ccInterest, nil } diff --git a/internal/pkg/gateway/api.go b/internal/pkg/gateway/api.go index 8ee9cf908fc..ba4aab4bdb8 100644 --- a/internal/pkg/gateway/api.go +++ b/internal/pkg/gateway/api.go @@ -171,7 +171,7 @@ func (gs *Server) Endorse(ctx context.Context, request *gp.EndorseRequest) (*gp. success, message, _, remove := gs.responseStatus(firstResponse, err) if !success { - logger.Debugw("Endorse call to endorser failed", "channel", request.ChannelId, "txid", request.TransactionId, "endorserAddress", firstEndorser.endpointConfig.address, "endorserMspid", firstEndorser.endpointConfig.mspid, "error", message) + logger.Warnw("Endorse call to endorser failed", "channel", request.ChannelId, "txid", request.TransactionId, "endorserAddress", firstEndorser.endpointConfig.address, "endorserMspid", firstEndorser.endpointConfig.mspid, "error", message) errDetails = append(errDetails, errorDetail(firstEndorser.endpointConfig, message)) if remove { gs.registry.removeEndorser(firstEndorser) @@ -244,7 +244,7 @@ func (gs *Server) Endorse(ctx context.Context, request *gp.EndorseRequest) (*gp. responseCh <- &endorserResponse{endorsementSet: endorsements} e = nil } else { - logger.Debugw("Endorse call to endorser failed", "channel", request.ChannelId, "txid", request.TransactionId, "numEndorsers", len(endorsers), "endorserAddress", e.endpointConfig.address, "endorserMspid", e.endpointConfig.mspid, "error", message) + logger.Warnw("Endorse call to endorser failed", "channel", request.ChannelId, "txid", request.TransactionId, "numEndorsers", len(endorsers), "endorserAddress", e.endpointConfig.address, "endorserMspid", e.endpointConfig.mspid, "error", message) responseCh <- &endorserResponse{err: errorDetail(e.endpointConfig, message)} if remove { gs.registry.removeEndorser(e)