You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

164 lines
10 KiB

  1. ---
  2. order: 7
  3. ---
  4. ## Logging
  5. Logging adds detail and allows the node operator to better identify what they are looking for. Tendermint supports log levels on a global and per-module basis. This allows the node operator to see only the information they need and the developer to hone in on specific changes they are working on.
  6. ## Configuring Log Levels
  7. There are three log levels, `info`, `debug` and `error`. These can be configured either through the command line via `tendermint start --log-level ""` or within the `config.toml` file.
  8. - `info` Info represents an informational message. It is used to show that modules have started, stopped and how they are functioning.
  9. - `debug` Debug is used to trace various calls or problems. Debug is used widely throughout a codebase and can lead to overly verbose logging.
  10. - `error` Error represents something that has gone wrong. An error log can represent a potential problem that can lead to a node halt.
  11. Within the `config.toml`:
  12. ```toml
  13. # Output level for logging, including package level options
  14. log-level = "info"
  15. ```
  16. Via the command line:
  17. ```sh
  18. tendermint start --log-level "info"
  19. ```
  20. ## List of modules
  21. Here is the list of modules you may encounter in Tendermint's log and a
  22. little overview what they do.
  23. - `abci-client` As mentioned in [Application Architecture Guide](../app-dev/app-architecture.md), Tendermint acts as an ABCI
  24. client with respect to the application and maintains 3 connections:
  25. mempool, consensus and query. The code used by Tendermint Core can
  26. be found [here](https://github.com/tendermint/tendermint/tree/master/abci/client).
  27. - `blockchain` Provides storage, pool (a group of peers), and reactor
  28. for both storing and exchanging blocks between peers.
  29. - `consensus` The heart of Tendermint core, which is the
  30. implementation of the consensus algorithm. Includes two
  31. "submodules": `wal` (write-ahead logging) for ensuring data
  32. integrity and `replay` to replay blocks and messages on recovery
  33. from a crash.
  34. [here](https://github.com/tendermint/tendermint/blob/master/types/events.go).
  35. You can subscribe to them by calling `subscribe` RPC method. Refer
  36. to [RPC docs](../tendermint-core/rpc.md) for additional information.
  37. - `mempool` Mempool module handles all incoming transactions, whenever
  38. they are coming from peers or the application.
  39. - `p2p` Provides an abstraction around peer-to-peer communication. For
  40. more details, please check out the
  41. [README](https://github.com/tendermint/spec/tree/master/spec/p2p).
  42. - `rpc-server` RPC server. For implementation details, please read the
  43. [doc.go](https://github.com/tendermint/tendermint/blob/master/rpc/jsonrpc/doc.go).
  44. - `state` Represents the latest state and execution submodule, which
  45. executes blocks against the application.
  46. - `statesync` Provides a way to quickly sync a node with pruned history.
  47. ### Walkabout example
  48. We first create three connections (mempool, consensus and query) to the
  49. application (running `kvstore` locally in this case).
  50. ```sh
  51. I[10-04|13:54:27.364] Starting multiAppConn module=proxy impl=multiAppConn
  52. I[10-04|13:54:27.366] Starting localClient module=abci-client connection=query impl=localClient
  53. I[10-04|13:54:27.366] Starting localClient module=abci-client connection=mempool impl=localClient
  54. I[10-04|13:54:27.367] Starting localClient module=abci-client connection=consensus impl=localClient
  55. ```
  56. Then Tendermint Core and the application perform a handshake.
  57. ```sh
  58. I[10-04|13:54:27.367] ABCI Handshake module=consensus appHeight=90 appHash=E0FBAFBF6FCED8B9786DDFEB1A0D4FA2501BADAD
  59. I[10-04|13:54:27.368] ABCI Replay Blocks module=consensus appHeight=90 storeHeight=90 stateHeight=90
  60. I[10-04|13:54:27.368] Completed ABCI Handshake - Tendermint and App are synced module=consensus appHeight=90 appHash=E0FBAFBF6FCED8B9786DDFEB1A0D4FA2501BADAD
  61. ```
  62. After that, we start a few more things like the event switch, reactors,
  63. and perform UPNP discover in order to detect the IP address.
  64. ```sh
  65. I[10-04|13:54:27.374] Starting EventSwitch module=types impl=EventSwitch
  66. I[10-04|13:54:27.375] This node is a validator module=consensus
  67. I[10-04|13:54:27.379] Starting Node module=main impl=Node
  68. I[10-04|13:54:27.381] Local listener module=p2p ip=:: port=26656
  69. I[10-04|13:54:27.382] Getting UPNP external address module=p2p
  70. I[10-04|13:54:30.386] Could not perform UPNP discover module=p2p err="write udp4 0.0.0.0:38238->239.255.255.250:1900: i/o timeout"
  71. I[10-04|13:54:30.386] Starting DefaultListener module=p2p impl=Listener(@10.0.2.15:26656)
  72. I[10-04|13:54:30.387] Starting P2P Switch module=p2p impl="P2P Switch"
  73. I[10-04|13:54:30.387] Starting MempoolReactor module=mempool impl=MempoolReactor
  74. I[10-04|13:54:30.387] Starting BlockchainReactor module=blockchain impl=BlockchainReactor
  75. I[10-04|13:54:30.387] Starting ConsensusReactor module=consensus impl=ConsensusReactor
  76. I[10-04|13:54:30.387] ConsensusReactor module=consensus fastSync=false
  77. I[10-04|13:54:30.387] Starting ConsensusState module=consensus impl=ConsensusState
  78. I[10-04|13:54:30.387] Starting WAL module=consensus wal=/home/vagrant/.tendermint/data/cs.wal/wal impl=WAL
  79. I[10-04|13:54:30.388] Starting TimeoutTicker module=consensus impl=TimeoutTicker
  80. ```
  81. Notice the second row where Tendermint Core reports that "This node is a
  82. validator". It also could be just an observer (regular node).
  83. Next we replay all the messages from the WAL.
  84. ```sh
  85. I[10-04|13:54:30.390] Catchup by replaying consensus messages module=consensus height=91
  86. I[10-04|13:54:30.390] Replay: New Step module=consensus height=91 round=0 step=RoundStepNewHeight
  87. I[10-04|13:54:30.390] Replay: Done module=consensus
  88. ```
  89. "Started node" message signals that everything is ready for work.
  90. ```sh
  91. I[10-04|13:54:30.391] Starting RPC HTTP server on tcp socket 0.0.0.0:26657 module=rpc-server
  92. I[10-04|13:54:30.392] Started node module=main nodeInfo="NodeInfo{id: DF22D7C92C91082324A1312F092AA1DA197FA598DBBFB6526E, moniker: anonymous, network: test-chain-3MNw2N [remote , listen 10.0.2.15:26656], version: 0.11.0-10f361fc ([wire_version=0.6.2 p2p_version=0.5.0 consensus_version=v1/0.2.2 rpc_version=0.7.0/3 tx_index=on rpc_addr=tcp://0.0.0.0:26657])}"
  93. ```
  94. Next follows a standard block creation cycle, where we enter a new
  95. round, propose a block, receive more than 2/3 of prevotes, then
  96. precommits and finally have a chance to commit a block. For details,
  97. please refer to [Byzantine Consensus
  98. Algorithm](https://github.com/tendermint/spec/blob/master/spec/consensus/consensus.md).
  99. ```sh
  100. I[10-04|13:54:30.393] enterNewRound(91/0). Current: 91/0/RoundStepNewHeight module=consensus
  101. I[10-04|13:54:30.393] enterPropose(91/0). Current: 91/0/RoundStepNewRound module=consensus
  102. I[10-04|13:54:30.393] enterPropose: Our turn to propose module=consensus proposer=125B0E3C5512F5C2B0E1109E31885C4511570C42 privValidator="PrivValidator{125B0E3C5512F5C2B0E1109E31885C4511570C42 LH:90, LR:0, LS:3}"
  103. I[10-04|13:54:30.394] Signed proposal module=consensus height=91 round=0 proposal="Proposal{91/0 1:21B79872514F (-1,:0:000000000000) {/10EDEDD7C84E.../}}"
  104. I[10-04|13:54:30.397] Received complete proposal block module=consensus height=91 hash=F671D562C7B9242900A286E1882EE64E5556FE9E
  105. I[10-04|13:54:30.397] enterPrevote(91/0). Current: 91/0/RoundStepPropose module=consensus
  106. I[10-04|13:54:30.397] enterPrevote: ProposalBlock is valid module=consensus height=91 round=0
  107. I[10-04|13:54:30.398] Signed and pushed vote module=consensus height=91 round=0 vote="Vote{0:125B0E3C5512 91/00/1(Prevote) F671D562C7B9 {/89047FFC21D8.../}}" err=null
  108. I[10-04|13:54:30.401] Added to prevote module=consensus vote="Vote{0:125B0E3C5512 91/00/1(Prevote) F671D562C7B9 {/89047FFC21D8.../}}" prevotes="VoteSet{H:91 R:0 T:1 +2/3:F671D562C7B9242900A286E1882EE64E5556FE9E:1:21B79872514F BA{1:X} map[]}"
  109. I[10-04|13:54:30.401] enterPrecommit(91/0). Current: 91/0/RoundStepPrevote module=consensus
  110. I[10-04|13:54:30.401] enterPrecommit: +2/3 prevoted proposal block. Locking module=consensus hash=F671D562C7B9242900A286E1882EE64E5556FE9E
  111. I[10-04|13:54:30.402] Signed and pushed vote module=consensus height=91 round=0 vote="Vote{0:125B0E3C5512 91/00/2(Precommit) F671D562C7B9 {/80533478E41A.../}}" err=null
  112. I[10-04|13:54:30.404] Added to precommit module=consensus vote="Vote{0:125B0E3C5512 91/00/2(Precommit) F671D562C7B9 {/80533478E41A.../}}" precommits="VoteSet{H:91 R:0 T:2 +2/3:F671D562C7B9242900A286E1882EE64E5556FE9E:1:21B79872514F BA{1:X} map[]}"
  113. I[10-04|13:54:30.404] enterCommit(91/0). Current: 91/0/RoundStepPrecommit module=consensus
  114. I[10-04|13:54:30.405] Finalizing commit of block with 0 txs module=consensus height=91 hash=F671D562C7B9242900A286E1882EE64E5556FE9E root=E0FBAFBF6FCED8B9786DDFEB1A0D4FA2501BADAD
  115. I[10-04|13:54:30.405] Block{
  116. Header{
  117. ChainID: test-chain-3MNw2N
  118. Height: 91
  119. Time: 2017-10-04 13:54:30.393 +0000 UTC
  120. NumTxs: 0
  121. LastBlockID: F15AB8BEF9A6AAB07E457A6E16BC410546AA4DC6:1:D505DA273544
  122. LastCommit: 56FEF2EFDB8B37E9C6E6D635749DF3169D5F005D
  123. Data:
  124. Validators: CE25FBFF2E10C0D51AA1A07C064A96931BC8B297
  125. App: E0FBAFBF6FCED8B9786DDFEB1A0D4FA2501BADAD
  126. }#F671D562C7B9242900A286E1882EE64E5556FE9E
  127. Data{
  128. }#
  129. Commit{
  130. BlockID: F15AB8BEF9A6AAB07E457A6E16BC410546AA4DC6:1:D505DA273544
  131. Precommits: Vote{0:125B0E3C5512 90/00/2(Precommit) F15AB8BEF9A6 {/FE98E2B956F0.../}}
  132. }#56FEF2EFDB8B37E9C6E6D635749DF3169D5F005D
  133. }#F671D562C7B9242900A286E1882EE64E5556FE9E module=consensus
  134. I[10-04|13:54:30.408] Executed block module=state height=91 validTxs=0 invalidTxs=0
  135. I[10-04|13:54:30.410] Committed state module=state height=91 txs=0 hash=E0FBAFBF6FCED8B9786DDFEB1A0D4FA2501BADAD
  136. I[10-04|13:54:30.410] Recheck txs module=mempool numtxs=0 height=91
  137. ```