There are plenty of ways to troubleshoot an error in your solution as well as multiple points where information about what's happening may be useful to diagnose your situation.
Your main tools are the following:
- Code editor/IDE: we recommend Visual Studio code, as it makes it easier to spot code errors and connect dependencies between files.
- Terminal: your preferred terminal will help you navigate and work with the various components in your workflow.
- Docker: Docker runs the containers with that give life to your local blockchain network. It runs multiple containers, each one of them has logs and setting you can access from your Terminal.
- Your project folder: this is where your code resides and is accessible to you.
- Hurley folder: it's usually located at
~/hyperledger-fabric-network/it contains all the files you need to have a local blockchain network running.
- Local dependencies: you need some previous components in your computer to run Hyperledger Fabric and therefore Convector. Take a look here for them as most of the errors usually come from missing pre-requisites.
Overall these are the main components in your development environment:
- Your chaincode code.
- Your running environment.
- That includes the containers running in Docker for the blockchain network, but also the files it depends on in your local file system and the containers running the chaincode you developed.
- Your server (if you have one).
Using logs is the most effective way to see what happens. We typically recommend that you develop with debugging on like explained here. That way you can see what happens inside of your server and your chaincode.
Logs sources are the following:
- Your Terminal console when running your chaincode with debugging on.
- Your Terminal console when running the server.
- Docker logs through your Terminal console for the blockchain network
- Docker logs through your Terminal console for a running chaincode logs.
By default, you will get logs from source 1 and 2. But sometimes you may need more logs or to dig into the existing ones.
What you need to is the following in your preferred Terminal Console:
- Find your containers running.
- This will bring a list of containers in your environment:
- Pick the Container ID or Name to get its logs.
docker logs <container-id>for example
- Optionally you can get the logs in a stream (realtime) but that Terminal tab will be locked with these logs:
docker logs -f 365a949ae334
You can use that same method to get chaincode logs, after installing your chaincode, repeat step 1.a, spot the container running the chaincode and run 2.a again.
A chaincode container looks like this: