Followed docs at https://book.getfoundry.sh/reference/forge-std/console-log

Tests are passing but console.log is not doing anything. I excepted it would print the output in the terminal.

Test contract is as follows:

pragma solidity =0.8.17;
import "forge-std/console.sol";
import "forge-std/Test.sol";

contract ProjectTest is Test {
  ProjectRouter router;

  function setUp() public {
    router = new ProjectRouter();
    console.log("DONE"); // NOT WORKING

  function test() public { // PASSED
    string memory name = router.name();
    assertEq(router.name(), "Router");

  function test123() public { // PASSED
    console.log(123); // NOT WORKING


contract ProjectTest is console, Test

But that gave more than 256 errors which look like this:

error[9097]: DeclarationError: Identifier already declared.
    --> lib/forge-std/src/console.sol:2090:3:
2090 |   function log(bool p0, bool p1, bool p2, uint p3) internal view {
     |   ^ (Relevant source part starts here and spans across multiple lines).
Note: The previous declaration is here:
  --> lib/forge-std/lib/ds-test/src/test.sol:19:5:
19 |     event log                    (string);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  • what command are you running for the test?
    – Bob Baxley
    Commented Jan 11, 2023 at 16:54
  • I'm using "forge test"
    – Delvir0
    Commented Jan 11, 2023 at 18:56

1 Answer 1


You need to increase the verbosity of forge test

That is, try forge test -vv for the log output. or forge test -vvvv for a full trace of every function call.


-v --verbosity Verbosity of the EVM.

Pass multiple times to increase the verbosity (e.g. -v, -vv, -vvv).

Verbosity levels:
- 2: Print logs for all tests
- 3: Print execution traces for failing tests
- 4: Print execution traces for all tests, and setup traces for failing tests
- 5: Print execution and setup traces for all tests

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.