dongqun9403 2019-03-15 18:15
浏览 338
已采纳

在Hyperledger架构中,如何打印出链码函数的消息和日志?

I want to test my chaincode by Golang, so I have used Hyperledger fabric chaincodedev test.

All functions of chaincode (invoke, query, etc.) worked, but there are no logs and messages of chaincode on console.

Logging is set to "debug" in every case.

I want to print out result message of invoke, query on console, but just print out message: "myc"; "myc"; "myc"; ...

2019-03-15 18:07:04.550 UTC [shim] setupChaincodeLogging -> INFO 001 Chaincode log level not provided; defaulting to: INFO
2019-03-15 18:07:04.550 UTC [shim] setupChaincodeLogging -> INFO 002 Chaincode (build level: ) starting up ...
2019-03-15 18:07:04.551 UTC [bccsp] initBCCSP -> DEBU 001 Initialize BCCSP [SW]
2019-03-15 18:07:04.551 UTC [grpc] DialContext -> DEBU 002 parsed scheme: ""
2019-03-15 18:07:04.551 UTC [grpc] DialContext -> DEBU 003 scheme "" not registered, fallback to default scheme
2019-03-15 18:07:04.551 UTC [grpc] watcher -> DEBU 004 ccResolverWrapper: sending new addresses to cc: [{peer:7052 0  <nil>}]
2019-03-15 18:07:04.551 UTC [grpc] switchBalancer -> DEBU 005 ClientConn switching balancer to "pick_first"
2019-03-15 18:07:04.551 UTC [grpc] HandleSubConnStateChange -> DEBU 006 pickfirstBalancer: HandleSubConnStateChange: 0xc00038eca0, CONNECTING
2019-03-15 18:07:04.552 UTC [grpc] HandleSubConnStateChange -> DEBU 007 pickfirstBalancer: HandleSubConnStateChange: 0xc00038eca0, READY

myc myc myc myc myc myc myc

enter image description here

  • 写回答

2条回答 默认 最新

  • douhuang2673 2019-03-16 02:02
    关注

    It's look like fmt.Println output.

    But you can user

    shim.NewLogger("YOUR_COMPONENT_NAME")
    

    You can found an example of shim logger :

    https://github.com/IBM-Blockchain-Archive/fabric-boilerplate/blob/master/blockchain/src/build-chaincode/chaincode.go

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥30 python,LLM 文本提炼
  • ¥15 关于将inet引入的相关问题
  • ¥15 关于一个倒计时的操作和显示设计
  • ¥15 提问STK的问题,哪位航天领域的同学会啊
  • ¥15 苹果系统的mac m1芯片的笔记本使用ce修改器使用不了
  • ¥15 单相逆变的电压电流双闭环中进行低通滤波PID算法改进
  • ¥15 关于#java#的问题,请各位专家解答!
  • ¥15 如何卸载arcgis 10.1 data reviewer for desktop
  • ¥15 共享文件夹会话中为什么会有WORKGROUP
  • ¥15 关于#python#的问题:使用ATL02数据解算光子脚点的坐标(操作系统-windows)