From c0096c633828212534f178a094c2791dd60e76fe Mon Sep 17 00:00:00 2001 From: Alexandra Tran Carrillo <12214231+alexandratran@users.noreply.github.com> Date: Thu, 6 Jun 2024 08:40:38 -0700 Subject: [PATCH] Document logging invalid txs (#1608) --- .../public-networks/how-to/monitor/logging.md | 53 +++++++++++++++++-- 1 file changed, 49 insertions(+), 4 deletions(-) diff --git a/docs/public-networks/how-to/monitor/logging.md b/docs/public-networks/how-to/monitor/logging.md index 026e034c6f4..edcf00dd99c 100644 --- a/docs/public-networks/how-to/monitor/logging.md +++ b/docs/public-networks/how-to/monitor/logging.md @@ -11,7 +11,7 @@ tags: # Use logging -Hyperledger Besu uses Log4J2 for logging and provides two methods to configure logging behavior: +Hyperledger Besu uses [Log4j 2](https://logging.apache.org/log4j/2.x/) for logging and provides two methods to configure logging behavior: - [Basic](#basic-logging) - Changes the log level. - [Advanced](#advanced-logging) - Configures the output and format of the logs. @@ -32,7 +32,7 @@ Use the [`admin_changeLogLevel`](../../reference/api/index.md#admin_changeloglev ## Advanced logging -You can provide your own logging configuration using the standard Log4J2 configuration mechanisms. For example, the following Log4J2 configuration is the same as the [default configuration] except for the exclusion of logging of stack traces for exceptions. +You can provide your own logging configuration using the standard Log4j 2 configuration mechanisms. For example, the following Log4j 2 configuration is the same as the [default configuration] except for the exclusion of logging of stack traces for exceptions: ```xml title="debug.xml" @@ -56,7 +56,7 @@ You can provide your own logging configuration using the standard Log4J2 configu To use your custom configuration, set the environment variable `LOG4J_CONFIGURATION_FILE` to the location of your configuration file. -If you have more specific requirements, you can create your own [log4j2 configuration](https://logging.apache.org/log4j/2.x/manual/configuration.html). +If you have more specific requirements, you can create your own [Log4j 2 configuration](https://logging.apache.org/log4j/2.x/manual/configuration.html). For Bash-based executions, you can set the variable for only the scope of the program execution by setting it before starting Besu. @@ -66,9 +66,54 @@ To set the debug logging and start Besu connected to the Holesky testnet: LOG4J_CONFIGURATION_FILE=./debug.xml besu --network=holesky ``` +### Log invalid transactions + +You can log information about invalid transactions that have been removed from the transaction pool. + +Use the log marker `INVALID_TX_REMOVED` and the following fields to format the log line as required: + +- `txhash` - The hash of the transaction. +- `txlog` - The human-readable log of the transaction. +- `reason` - The reason the transaction is invalid. +- `txrlp` - The RLP encoding of the transaction. + +For example, the following Log4j 2 configuration enables logging of invalid transactions: + +```xml title="debug.xml" + + + + INFO + + + + + + + + + + + + + + + + + + + + + + + + + +``` + ### Log rotation -[Quorum Developer Quickstart](https://github.com/ConsenSys/quorum-dev-quickstart) logging configuration defines a [log rotation to restrict the size of the log files]. +The [Quorum Developer Quickstart](https://github.com/ConsenSys/quorum-dev-quickstart) logging configuration defines a [log rotation to restrict the size of the log files].