Stdout and stderr

As well as the logging mechanisms provided by the SHIM API and integrated with the peer, during the development phase, the chaincode can use the standard output files. The chaincode is executed as an independent process and can therefore use the standard output (stdout) and standard error (stderr) files to record output using standard Go printing functions (for example, fmt.Printf(...) and os.Stdout). By default, the standard outputs are available in Dev mode, when the chaincode process is started independently.

In a production environment when the chaincode process is managed by the peer, the standard output is disabled for security reasons. When required, it can be enabled by setting the configuration variable CORE_VM_DOCKER_ATTACHSTDOUT of the peer. The outputs of the chaincode are then combined with the outputs of the peer. Keep in mind that these outputs should only be used for debugging purposes and should not be enabled in a production environment.

The following snippet illustrates additional SHIM API functions:

peer0.org1.example.com: 
   environment: 
         - CORE_VM_DOCKER_ATTACHSTDOUT=true 
Listing 4.1: Enabling chaincode standard output files on a peer in docker-compose file.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.116.15.161