From 4f8822584264060eaa20c35f845f412dc4abcedb Mon Sep 17 00:00:00 2001 From: Yuki Kondo Date: Mon, 12 Jun 2017 17:27:14 -0700 Subject: [PATCH] [FAB-4591]Fix log message formatting Log formatting is not correct in some codes. There are log messages with format designator called by "Debug", "Warning" or "Info". These logging messages should be called by "Debugf", "Warningf" or "Infof". This patch fixes log formatting. Change-Id: Ic9777b1eb67ccd6ef76aebb365916f8c4dc3e8d6 Signed-off-by: Yuki Kondo --- core/committer/txvalidator/validator.go | 4 ++-- core/container/dockercontroller/dockercontroller.go | 2 +- gossip/service/gossip_service.go | 2 +- peer/gossip/sa.go | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/core/committer/txvalidator/validator.go b/core/committer/txvalidator/validator.go index 26d3ae385fa..fdbf1622e8f 100644 --- a/core/committer/txvalidator/validator.go +++ b/core/committer/txvalidator/validator.go @@ -141,13 +141,13 @@ func (v *txValidator) Validate(block *common.Block) error { chdr, err := utils.UnmarshalChannelHeader(payload.Header.ChannelHeader) if err != nil { - logger.Warning("Could not unmarshal channel header, err %s, skipping", err) + logger.Warningf("Could not unmarshal channel header, err %s, skipping", err) txsfltr.SetFlag(tIdx, peer.TxValidationCode_INVALID_OTHER_REASON) continue } channel := chdr.ChannelId - logger.Debug("Transaction is for chain %s", channel) + logger.Debugf("Transaction is for chain %s", channel) if !v.chainExists(channel) { logger.Errorf("Dropping transaction for non-existent chain %s", channel) diff --git a/core/container/dockercontroller/dockercontroller.go b/core/container/dockercontroller/dockercontroller.go index 0eb062fb4a3..cf864ea37d2 100644 --- a/core/container/dockercontroller/dockercontroller.go +++ b/core/container/dockercontroller/dockercontroller.go @@ -404,7 +404,7 @@ func (vm *DockerVM) Destroy(ctxt context.Context, ccid ccintf.CCID, force bool, if err != nil { dockerLogger.Errorf("error while destroying image: %s", err) } else { - dockerLogger.Debug("Destroyed image %s", id) + dockerLogger.Debugf("Destroyed image %s", id) } return err diff --git a/gossip/service/gossip_service.go b/gossip/service/gossip_service.go index b498b95f72e..effc4274b7b 100644 --- a/gossip/service/gossip_service.go +++ b/gossip/service/gossip_service.go @@ -262,7 +262,7 @@ func (g *gossipServiceImpl) Stop() { } for chainID, electionService := range g.leaderElection { - logger.Info("Stopping leader election for %s", chainID) + logger.Infof("Stopping leader election for %s", chainID) electionService.Stop() } g.gossipSvc.Stop() diff --git a/peer/gossip/sa.go b/peer/gossip/sa.go index 898ba271749..949af8a6b90 100644 --- a/peer/gossip/sa.go +++ b/peer/gossip/sa.go @@ -75,14 +75,14 @@ func (advisor *mspSecurityAdvisor) OrgByPeerIdentity(peerIdentity api.PeerIdenti // Deserialize identity identity, err := mspManager.DeserializeIdentity([]byte(peerIdentity)) if err != nil { - saLogger.Debug("Failed deserialization identity [% x] on [%s]: [%s]", peerIdentity, chainID, err) + saLogger.Debugf("Failed deserialization identity [% x] on [%s]: [%s]", peerIdentity, chainID, err) continue } return []byte(identity.GetMSPIdentifier()) } - saLogger.Warning("Peer Identity [% x] cannot be desirialized. No MSP found able to do that.", peerIdentity) + saLogger.Warningf("Peer Identity [% x] cannot be desirialized. No MSP found able to do that.", peerIdentity) return nil }