I've been having a very hard time with Solidity development due to not being able to easily console log as well as the truffle debugger causing problems.

How do you console log in Solidity?

Truffle debug doesn't seem to work very well when you've used inheritance. When a function throws an exception the event logs don't help correct? What is the easiest way to listen for event logs using a tool like Ganache or Truffle?

2 Answers 2


You can't really console log with solidity, and truffle sometimes won't help much about understanding where your code fails.

Truffle indicates somes issues and warnings (like unused declared vars) but, as you mentionned, when using inheritance it can be a pain.

An easy way to deal with this, the one i use, is to load or copy/paste the .sol files into the remix IDE and check what are the issues it shows.

Once done and issues fixed i move my fixed code into the relevant files.

Note that you can download Remix IDE and create your own instance of it here

It might not be the perfect solution but awaiting for truffle to provide more information when having some issues, remix IDE is a very good tool for debugging. On my side i use truffle only for compiling and rely on the IDE for debugging.


You can console log with Solidity in development!

Just create an event for your contract that takes a string as an argument. Then fire that event anywhere you want in your contract code. You'll be able to follow the flow of the contract from looking at the events that are recorded along with the transaction. If you need to see a numeric value / address, just create an event of that type.

Note though that this doesn't work if your contract actually fails, since that reverts the transaction. But you can work around this by commenting things out.

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.