Skip to main content

Use logging

Hyperledger Besu uses Log4J2 for logging and provides two methods to configure logging behavior:

  • Basic - Changes the log level.
  • Advanced - Configures the output and format of the logs.

Quorum Developer Quickstart provides an example implementation using Elastic Stack for log management.

Basic logging

Use the --logging command line option to specify logging verbosity. The --logging option changes the volume of events displayed in the log. Valid log levels are OFF, ERROR, WARN, INFO, DEBUG, TRACE, ALL. The default level is INFO.

For most use cases, the basic method provides enough configurability.


Use the admin_changeLogLevel API method to change the log level while Besu is running.

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.

<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="INFO">
<Property name="root.log.level">INFO</Property>

<Console name="Console" target="SYSTEM_OUT">
<PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss.SSSZZZ} | %t | %-5level | %c{1} | %msg %throwable{short.message}%n" />
<Root level="${sys:root.log.level}">
<AppenderRef ref="Console" />

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.

For Bash-based executions, you can set the variable for only the scope of the program execution by setting it before starting Besu.

To set the debug logging and start Besu connected to the Goerli testnet:

LOG4J_CONFIGURATION_FILE=./debug.xml besu --network=goerli

Log rotation

Quorum Developer Quickstart logging configuration defines a log rotation to restrict the size of the log files.