yih*_*ang 3 hyperledger hyperledger-fabric
谁能告诉我如何通过更改 docker 文件中的环境变量来设置 Fabric 中特定模块的调试级别?在对等日志中,我们可以看到
2017-07-24 03:44:44.787 UTC [flogging] setModuleLevel -> DEBU 189 模块“msp/identity”记录器启用日志级别“警告”
2017-07-24 03:44:44.787 UTC [flogging] setModuleLevel -> DEBU 18a 模块“msp”记录器启用日志级别“警告”
2017-07-24 03:44:44.787 UTC [flogging] setModuleLevel -> DEBU 18b 模块“configvalues/msp”记录器启用日志级别“警告”
2017-07-24 03:44:44.787 UTC [flogging] setModuleLevel -> DEBU 18c 模块“peer/gossip/mcs”记录器启用日志级别“警告”
2017-07-24 03:44:44.787 UTC [flogging] setModuleLevel -> DEBU 18d 模块“gossip/state”记录器启用日志级别“警告”
我希望其中一些处于调试模式,如何实现?仅供参考,我尝试设置GOSSIP_SERVICE_LOGGING_LEVEL=DEBUG
并使GRPC_LOGGING_LEVEL=DEBUG
模块 gossip/service 和 grpc 处于调试模式,但它不起作用:( ...
为了更改模块的日志记录级别,您需要在core.yaml
文件中进行更改:
###############################################################################
#
# LOGGING section
#
###############################################################################
logging:
# Default logging levels are specified here.
# Valid logging levels are case-insensitive strings chosen from
# CRITICAL | ERROR | WARNING | NOTICE | INFO | DEBUG
# The overall default logging level can be specified in various ways,
# listed below from strongest to weakest:
#
# 1. The --logging-level=<level> command line option overrides all other
# default specifications.
#
# 2. The environment variable CORE_LOGGING_LEVEL otherwise applies to
# all peer commands if defined as a non-empty string.
#
# 3. The value of peer that directly follows in this file. It can also
# be set via the environment variable CORE_LOGGING_PEER.
#
# If no overall default level is provided via any of the above methods,
# the peer will default to INFO (the value of defaultLevel in
# common/flogging/logging.go)
# Default for all modules running within the scope of a peer.
# Note: this value is only used when --logging-level or CORE_LOGGING_LEVEL
# are not set
peer: info
# The overall default values mentioned above can be overridden for the
# specific components listed in the override section below.
# Override levels for various peer modules. These levels will be
# applied once the peer has completely started. They are applied at this
# time in order to be sure every logger has been registered with the
# logging package.
# Note: the modules listed below are the only acceptable modules at this
# time.
cauthdsl: warning
gossip: warning
ledger: info
msp: warning
policies: warning
grpc: error
# Message format for the peer logs
format: '%{color}%{time:2006-01-02 15:04:05.000 MST} [%{module}] %{shortfunc} -> %{level:.4s} %{id:03x}%{color:reset} %{message}'
Run Code Online (Sandbox Code Playgroud)
或者您可以使用peer cli
工具在运行时更新日志记录级别:
$ peer help logging
Log levels: getlevel|setlevel|revertlevels.
Usage:
peer logging [command]
Available Commands:
getlevel Returns the logging level of the requested module logger.
revertlevels Reverts the logging levels to the levels at the end of peer startup.
setlevel Sets the logging level for all modules that match the regular expression.
Global Flags:
--logging-level string Default logging level and overrides, see core.yaml for full syntax
--test.coverprofile string Done (default "coverage.cov")
-v, --version Display current version of fabric peer server
Use "peer logging [command] --help" for more information about a command.
Run Code Online (Sandbox Code Playgroud)
例如:
peer logging setlevel module_name debug
Run Code Online (Sandbox Code Playgroud)
将更新日志记录级别module_name
以进行调试。
归档时间: |
|
查看次数: |
3993 次 |
最近记录: |