Skip to main content
note

A new version of Mina Docs is coming soon! This page will be rewritten.

Logging

Mina logs are located in the configuration directory located at ~/.mina-config. This directory contains the following log files:

  • mina.log - this file contains the latest logs of the daemon. Each log file is limited to 10 Mebibyte (MiB) in size and rotates over 50 log files. Rotated log files are named mina.log.x from mina.log.0 to mina.log.50.
  • mina-best-tip.log - this file contains the best tip logs of the daemon. This file makes it easier to collect the required logs from nodes to determine the best state for any hard fork. This file is limited to 5 Mebibyte (MiB) in size and rotates over a single log file mina-best-tip.log.0.
  • mina-prover.log - this file contains logs for the prover's memory usage and batch sizes. It is limited to 128 Mebibyte (MiB) and rotates over a single log file.
  • mina-verifier.log - this file contains logs for the verifier's memory usage and batch sizes. It is limited to 128 Mebibyte (MiB) and rotates over a single log file.

To follow the logs, use one of the following commands, depending on how you started the daemon:

  • Docker: docker logs --follow mina
  • Running as a service: journalctl --user -u mina -n 1000 -f
  • Other: tail -f ~/.mina-config/mina.log

Log levels

The Mina daemon logs at the following levels, in this order of precedence:

  • Spam
  • Trace
  • Debug
  • Info
  • Warn
  • Error
  • Fatal
info

Specifying a log-level of Info will only display messages from that log level and above and significantly reduce the logs' verbosity.

Log format:

The format of the logs is defined by the following structure:

{
"timestamp": timestamp,
"level": level,
"source": {
"module": string,
"location": string
},
"message": format_string,
"metadata": {{...}}
}

An example error message is shown below:

{
"timestamp": "2020-12-23 21:25:04.616526Z",
"level": "Error",
"source": {
"module": "Transition_router",
"location": "File \"src/lib/transition_router/transition_router.ml\", line 231, characters 12-24"
},
"message": "Failed to find any peers during initialization (crashing because this is not a seed node)",
"metadata": {
"host": "1.1.1.2",
"peer_id": "12D3KooWGQSPgo7ypy9717D3Vgz2RHaqB2ndDRHEFcAfJDAv284q",
"pid": 12,
"port": 8302
}
}

Exporting logs

The Mina daemon provides a CLI helper to compress and package up the available log files from a node.

For a running daemon, run mina client export-logs where you can pass an optional flag -tarfile to specify the tar archive's filename, which defaults to the current date-time. This command compresses the available logs and exports them to the exported_logs directory in the ~/.mina-config directory.

info

The logs may be exported from a running node via GraphQL using the exportLogs mutation.

To export logs from a node that is not running, run the mina client export-local-logs command to compress the available local log files. Pass the tarfile option to specify the tar archive's filename, and the logs will be compressed and exported to the exported_logs directory in the ~/.mina-config directory.

info

When creating or updating an issue on GitHub, you can upload the exported tar.gz file directly to the issue.

Logging options

The following options may be set when starting the daemon to customize the logging behaviour:

  • -file-log-level - log level for the log file (default: Trace)
  • -log-level - log level for output to the terminal via stdout (default: Info)
  • -log-json - print log output as JSON (default: plain text)
  • -log-block-creation - log the steps involved in including transactions and snark work in a block (default: true)
  • -log-received-blocks - log blocks received from peers (default: false)
  • -log-snark-work-gossip - log snark-pool diffs received from peers (default: false)
  • -log-txn-pool-gossip - log transaction-pool diffs received from peers (default: false)
  • -log-precomputed-blocks - include precomputed blocks in the logs (default: false)

Crash Reports

If the daemon crashes and is able, it will generate a crash report. Only the latest crash report will be retained, with the filename indicating the date-time of the crash and the compressed file being exported to the ~/.mina-config directory. You can upload this crash report to any GitHub issue to identify new issues and aid in debugging.

The crash report will contain some, or all of, the following log files:

  • crash_summary.json - contains a summary of the crash, including the system info, the version information, and the final log output.
  • mina_status.json - an output of the mina client status command for a summary of the daemon's final state.
  • mina_short.log - contains the last 4MiB of the mina.log file.
  • registered_mask.dot - contains the latest ledger visualization.
  • frontier.dot - contains the latest frontier visualization.
  • daemon.json - a copy of the daemon configuration file.