Logging
debug_backtraceAt
Sets the logging backtrace location. When a backtrace location is set and a log message is emitted at that location, the stack of the goroutine executing the log statement will be printed to stderr
.
Console
debug.backtraceAt(location)
RPC
{"method": "debug_backtraceAt", "params": [string]}
Parameters
location
string
The logging backtrace location specified as <filename>:<line>
.
Return Value
None
Example
> debug.backtraceAt("server.go:443")
null
HTTP RPC
$ curl -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"debug_backtraceAt","params":["server.go:443"],"id":1}' https://public-en-baobab.klaytn.net
{"jsonrpc":"2.0","id":1,"result":null}
debug_setVMLogTarget
Sets the output target of vmlog precompiled contract. When the output target is a file, logs from vmlog
calls in smart contracts will be written to DATADIR/log/vm.log
. Here DATADIR
is the directory specified by --datadir
when launching klay
. On the other hand, the output target is stdout
, logs will be displayed like a debug message on the standard output.
Console
debug.setVMLogTarget(target)
RPC
{"method": "debug_setVMLogTarget", "params": [number]}
Parameters
target
int
The output target (0: no output, 1: file, 2: stdout, 3: both) (default: 0)
Return Value
string
The output target. See the examples below for the actual return values.
Example
Console
> debug.setVMLogTarget(0)
"no output"
> debug.setVMLogTarget(1)
"file"
> debug.setVMLogTarget(2)
"stdout"
> debug.setVMLogTarget(3)
"both file and stdout"
> debug.setVMLogTarget(4)
Error: target should be between 0 and 3
at web3.js:3239:20
at web3.js:6447:15
at web3.js:5181:36
at <anonymous>:1:1
HTTP RPC
$ curl -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"debug_setVMLogTarget","params":[3],"id":1}' https://public-en-baobab.klaytn.net
{"jsonrpc":"2.0","id":1,"result":"both file and stdout"}
debug_verbosity
Sets the logging verbosity ceiling. Log messages with level up to and including the given level will be printed.
(Level : 0=crit, 1=error, 2=warn, 3=info, 4=debug, 5=trace)
The verbosity of individual packages and source files can be raised using debug_vmodule
.
Console
debug.verbosity(level)
RPC
{"method": "debug_vmodule", "params": [number]}
Parameters
level
int
The logging verbosity level.
Return Value
None
Example
Console
> debug.verbosity(3)
null
HTTP RPC
$ curl -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"debug_verbosity","params":['3'],"id":1}' https://public-en-baobab.klaytn.net
{"jsonrpc":"2.0","id":1,"result":null}
debug_verbosityByName
Sets the verbosity of log module with given name. Please note that VerbosityByName only works with zapLogger.
(Level : 0=crit, 1=error, 2=warn, 3=info, 4=debug, 5=trace)
The verbosity of individual packages and source files can be raised using debug_vmodule
.
Console
debug.verbosityByName(name, level)
RPC
{"method": "debug_verbosityByName", "params": [string, number]}
Parameters
name
string
The module name.
level
int
The logging verbosity level.
Return Value
None
Example
Console
> debug.verbosityByName("name", 3)
null
HTTP RPC
$ curl -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"debug_verbosityByName","params":["name", '3'],"id":1}' https://public-en-baobab.klaytn.net
{"jsonrpc":"2.0","id":1,"result":null}
debug_verbosityByID
Sets the verbosity of log module with given ModuleID. Please note that VerbosityByID only works with zapLogger.
(ModuleID : Please refer to the code on the github. )
(Level : 0=crit, 1=error, 2=warn, 3=info, 4=debug, 5=trace)
The verbosity of individual packages and source files can be raised using debug_vmodule
.
Console
debug.verbosityByID(id, level)
RPC
{"method": "debug_verbosityByID", "params": [number, number]}
Parameters
id
int
The module id.
level
int
The logging verbosity level.
Return Value
None
Example
Console
> debug.verbosityById(1, 3)
null
HTTP RPC
$ curl -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"debug_verbosityById","params":['1',3'],"id":1}' https://public-en-baobab.klaytn.net
{"jsonrpc":"2.0","id":1,"result":null}
debug_vmodule
Sets the logging verbosity pattern.
Console
debug.vmodule(module)
RPC
{"method": "debug_vmodule", "params": [string]}
Parameters
module
string
The module name for logging.
Return Value
None
Example
Console
If you want to see messages from a particular Go package (directory) and all subdirectories, use
> debug.vmodule("p2p/*=5")
If you want to restrict messages to a particular package (e.g., p2p) but exclude subdirectories, use
> debug.vmodule("p2p=4")
If you want to see log messages from a particular source file, use
> debug.vmodule("server.go=3")
HTTP RPC
$ curl -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"debug_vmodule","params":["p2p=4"],"id":1}' https://public-en-baobab.klaytn.net
{"jsonrpc":"2.0","id":1,"result":null}
Last updated