mirror of https://github.com/hyperledger/besu
An enterprise-grade Java-based, Apache 2.0 licensed Ethereum client https://wiki.hyperledger.org/display/besu
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
67 lines
2.3 KiB
67 lines
2.3 KiB
6 years ago
|
description: Pantheon log level setting and log formatting
|
||
|
path: blob/master/pantheon/src/main/resources/
|
||
|
source: log4j2.xml
|
||
|
<!--- END of page meta data -->
|
||
|
|
||
|
# Logging
|
||
|
|
||
|
Pantheon uses Log4J2 for logging. There are two methods to configure logging behavior:
|
||
|
|
||
|
* Basic - changes the log level.
|
||
|
* Advanced - configures the output and format of the logs.
|
||
|
|
||
|
!!!note
|
||
|
For most use-cases, the basic method provides sufficient configurability.
|
||
|
|
||
|
## Basic Log Level Setting
|
||
|
|
||
6 years ago
|
Use the [`--logging`](../Reference/Pantheon-CLI-Syntax.md#logging) command line option to specify
|
||
|
the logging verbosity. The [`--logging`](../Reference/Pantheon-CLI-Syntax.md#logging) option changes
|
||
|
the volume of events displayed in the log.
|
||
6 years ago
|
|
||
5 years ago
|
!!! tip
|
||
|
Use the [`admin_changeLogLevel`](../Reference/Pantheon-API-Methods.md#admin_changeloglevel) API method
|
||
|
to change the log level while Pantheon is running.
|
||
|
|
||
6 years ago
|
## Advanced Custom Logging
|
||
|
|
||
6 years ago
|
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](https://github.com/PegaSysEng/pantheon/blob/master/pantheon/src/main/resources/log4j2.xml)
|
||
|
except logging of stack traces for exceptions is excluded.
|
||
6 years ago
|
|
||
6 years ago
|
```xml tab="debug.xml"
|
||
6 years ago
|
<?xml version="1.0" encoding="UTF-8"?>
|
||
|
<Configuration status="INFO">
|
||
|
<Properties>
|
||
|
<Property name="root.log.level">INFO</Property>
|
||
|
</Properties>
|
||
|
|
||
|
<Appenders>
|
||
|
<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" />
|
||
|
</Console>
|
||
|
</Appenders>
|
||
|
<Loggers>
|
||
|
<Root level="${sys:root.log.level}">
|
||
|
<AppenderRef ref="Console" />
|
||
|
</Root>
|
||
|
</Loggers>
|
||
|
</Configuration>
|
||
|
```
|
||
|
|
||
6 years ago
|
To use your custom configuration, set the environment variable `LOG4J_CONFIGURATION_FILE` to the
|
||
|
location of your configuration file.
|
||
6 years ago
|
|
||
6 years ago
|
If you have more specific requirements, you can create your own
|
||
|
[log4j2 configuration](https://logging.apache.org/log4j/2.x/manual/configuration.html).
|
||
6 years ago
|
|
||
6 years ago
|
For Bash-based executions, you can set the variable for only the scope of the program execution by
|
||
|
setting it before starting Pantheon.
|
||
6 years ago
|
|
||
6 years ago
|
!!!example
|
||
|
To set the debug logging and start Pantheon connected to the Rinkeby testnet:
|
||
|
|
||
|
```bash
|
||
6 years ago
|
LOG4J_CONFIGURATION_FILE=./debug.xml pantheon --network=rinkeby
|
||
6 years ago
|
```
|