我正在尝试在Hyperledger Fabric的Balance Transfer示例中启用对等/订购者日志记录,因此我可以了解Hyperledger Fabric项目的逐步共识和交易过程。
如果我们启动chaincode-docker-devmode的区块链网络,并转到执行以下命令的 Terminal 1
docker-compose -f docker-compose-simple.yaml up
我们可以轻松地在终端中查看所有对等/订购者/ cli日志,例如:
peer | 2018-07-26 08:58:07.426 UTC [chaincode] Execute -> DEBU 73d Entry
peer | 2018-07-26 08:58:07.426 UTC [chaincode] Execute -> DEBU 73e chaincode canonical name: escc:1.1.0
orderer | 2018-07-26 08:58:07.434 UTC [policies] Evaluate -> DEBU 3c4 Signature set satisfies policy /Channel/Orderer/SampleOrg/Writers
orderer | 2018-07-26 08:58:07.434 UTC [policies] Evaluate -> DEBU 3c5 == Done Evaluating *cauthdsl.policy Policy /Channel/Orderer/SampleOrg/Writers
orderer | 2018-07-26 08:58:07.434 UTC [policies] Evaluate -> DEBU 3c6 Signature set satisfies policy /Channel/Orderer/Writers
peer | 2018-07-26 08:58:07.426 UTC [chaincode] sendExecuteMessage -> DEBU 73f [82a18317]Inside sendExecuteMessage. Message TRANSACTION
peer | 2018-07-26 08:58:07.426 UTC [chaincode] setChaincodeProposal -> DEBU 740 Setting chaincode proposal context...
orderer | 2018-07-26 08:58:07.435 UTC [policies] Evaluate -> DEBU 3c7 == Done Evaluating *policies.implicitMetaPolicy Policy /Channel/Orderer/Writers
orderer | 2018-07-26 08:58:07.435 UTC [policies] Evaluate -> DEBU 3c8 Signature set satisfies policy /Channel/Writers
orderer | 2018-07-26 08:58:07.435 UTC [policies] Evaluate -> DEBU 3c9 == Done Evaluating *policies.implicitMetaPolicy Policy /Channel/Writers
orderer | 2018-07-26 08:58:07.436 UTC [orderer/common/blockcutter] Ordered -> DEBU 3ca Enqueuing message into batch
orderer | 2018-07-26 08:58:07.436 UTC [orderer/common/broadcast] Handle -> DEBU 3cb [channel: myc] Broadcast has successfully enqueued message of type ENDORSER_TRANSACTION from 172.23.0.5:57804
peer | 2018-07-26 08:58:07.426 UTC [chaincode] setChaincodeProposal -> DEBU 741 Proposal different from nil. Creating chaincode proposal context...
就我而言,我想将该条件复制到“余额转移”样本中。因此,当我运行./runApp.sh时,它将显示所有日志。
我该怎么做?我应该在Balance Transfer的docker-compose.yaml文件中放入什么环境?
谢谢!
答案 0 :(得分:1)
在余额转移中,转到目录工件并键入此命令。
docker-compose -f docker-compose.yaml logs -f
用于实时日志记录。[1] [2]
docker-compose -f docker-compose.yaml
记录`直至没有实时记录的点记录。
注意:在余额转移中运行脚本时,docker以分离模式启动docker容器:在后台运行容器,打印新的容器名称。这就是编排容器后不立即显示日志的原因。[3] [4]
参考:
[1]:Docker-如何查看Docker容器的实时日志记录? (https://success.docker.com/article/view-realtime-container-logging)
[2]:Docker容器日志| Docker文档(https://docs.docker.com/engine/reference/commandline/container_logs/)
[3]:泊坞窗运行| Docker文档(https://docs.docker.com/engine/reference/commandline/run/)
[4]:泊坞窗-组成| Docker文档(https://docs.docker.com/compose/reference/up/)