Skip to content

Running Hardhat with debug logs

If you are having a problem with Hardhat, you can run it with debug logs enabled.

For example, this runs the build process with debug logs:

Terminal window
DEBUG='hardhat*' npx hardhat build

You can filter which logs to display by adding a longer prefix to the DEBUG env variable.

For example, this runs the build process only with logs coming from Hardhat’s Solidity integration:

Terminal window
DEBUG='hardhat:core:solidity:*' npx hardhat build

The debug logs printed by Hardhat can include information that you may consider somewhat private.

These can include the following, and potentially more private pieces of data:

  • Your operating system user name
  • The absolute path to your Hardhat project
  • Your telemetry ID (this is a random number, but posting it online associates it to your identity)
  • The name of your contracts, if you consider those private
  • Potentially an RPC URL (we anonymize them whenever possible though)

Please review what you are posting online before doing so, and redact whatever you want to keep private.