Skip to content

Log Config

Yuanjun edited this page Jan 10, 2020 · 2 revisions

A sample log configuration file is as follows:

# Usage:
# encoder pattern:
# d: date, l: log level, t: target, L: line, m: message, n: new line

refresh_rate: 60 seconds
appenders:
  stdout:
    kind: console
    encoder:
      pattern: "{d(%Y-%m-%d %H:%M:%S)} {h({l})} {t}: {m}{n}"
  vm_log:
    kind: rolling_file
    path: "logs/vm.log"
    policy:
      kind: compound
      trigger:
        kind: size
        limit: 10mb
      roller:
        kind: fixed_window
        base: 1
        count: 30
        pattern: "logs/vm.log.{}.gz"
    encoder:
      pattern: "{d(%Y-%m-%d %H:%M:%S)} {l} {t}:{L} - {m}{n}"

root:
  level: info
  appenders:
    - stdout
loggers:
  vm:
    level: debug
    appenders:
      - vm_log
    additive: false
  sync:
    level: info
    appenders:
      - stdout
    additive: false
  rpc:
    level: warn
    appenders:
      - stdout
    additive: false
  ws:
    level: warn
    appenders:
      - stdout
    additive: false

The log configuration sections are defined in log4rs. Refer to log4rs-v0.7.0 for more details.

Use log targets to set the log level for some specified modules.

Targets remark
account
account_bloom
block
blockchain
builtin
client
cons
db
disk
enact
equihash
estimate_gas
executive
export
ext core/externalities
fatdb
import
io
journaldb
local_store
miner
net
nonce
overlay
own_tx
p2p_send
p2p_req
p2p_res
p2p_disconnect
p2p_handle
pb_api
perf trace-time
personal
poa submit seal
pubsub
reorg block reorganization when branch becoming canon chain
revert
rpc
rpc_tx
run
shutdown
spec
state
state_db
stats
stratum
sync_res
sync_req
sync_send
sync_statics
sync_disconnect
trie
tx
txqueue
verification
vm
ws

Clone this wiki locally