diff --git a/docs/Reference/API-Methods.md b/docs/Reference/API-Methods.md index 87c17a93d94..530317bad61 100644 --- a/docs/Reference/API-Methods.md +++ b/docs/Reference/API-Methods.md @@ -51,23 +51,29 @@ Adds a [static node](../HowTo/Find-and-Connect/Managing-Peers.md#static-nodes). ### admin_changeLogLevel -Change the log level without restarting Besu. +Changes the log level without restarting Besu. You can change the log level for all logs, or you can change the log level for specific packages or classes. + +Only one log level can be specified per RPC call. **Parameters** `level` - [Log level](CLI/CLI-Syntax.md#logging) +`log_filter`: `Array` - Packages or classes to change the log level for. Optional. + **Returns** `result` : `Success` if the log level has changed; otherwise `error`. +This example changes the debug level for specified classes to `DEBUG`. + !!! example ```bash tab="curl HTTP request" - curl -X POST --data '{"jsonrpc":"2.0","method":"admin_changeLogLevel","params":["DEBUG"], "id":1}' http://127.0.0.1:8545 + curl -X POST --data '{"jsonrpc":"2.0", "method":"admin_changeLogLevel", "params":["DEBUG", ["tech.pegasys.pantheon.ethereum.eth.manager","tech.pegasys.pantheon.ethereum.p2p.rlpx.connections.netty.ApiHandler"]], "id":1}' http://127.0.0.1:8545 ``` ```bash tab="wscat WS request" - {"jsonrpc":"2.0","method":"admin_changeLogLevel","params":["DEBUG"], "id":1} + {"jsonrpc":"2.0", "method":"admin_changeLogLevel", "params":["DEBUG", ["tech.pegasys.pantheon.ethereum.eth.manager","tech.pegasys.pantheon.ethereum.p2p.rlpx.connections.netty.ApiHandler"]], "id":1} ``` ```json tab="JSON result" @@ -77,7 +83,25 @@ Change the log level without restarting Besu. "result": "Success" } ``` +This example changes the debug level of all logs to `WARN`. +!!! example + ```bash tab="curl HTTP request" + curl -X POST --data '{"jsonrpc":"2.0","method":"admin_changeLogLevel","params":["WARN"], "id":1}' http://127.0.0.1:8545 + ``` + + ```bash tab="wscat WS request" + {"jsonrpc":"2.0","method":"admin_changeLogLevel","params":["WARN"], "id":1} + ``` + + ```json tab="JSON result" + { + "jsonrpc": "2.0", + "id": 1, + "result": "Success" + } + ``` + ### admin_nodeInfo Returns networking information about the node. The information includes general information about the node