davidkel / hlf

0 stars 0 forks source link

Dynamic Logging Capability for Smart Contracts #22

Open davidkel opened 4 years ago

davidkel commented 4 years ago

Various components of a fabric network can have logging dynamically controlled so you don't have to stop/start the components in order to get trace information. Chaincode processes don't have such an inbuilt capability but require the chaincode implementer to provide a solution or you have to stop the peer and chaincode and configure the peer to set the appropriate chaincode log level and restart the peer and for it to restart the chaincode process to get the appropriate log level set.

It should be possible for the chaincode container to accept a request to change it's log level dynamically. This capability should also allow the chaincode implementation enable it's log dynamically and also allow the requester to control whether the shim/contract code log level is changed or the log level of the chaincode itself or both to allow for granular control by the requester.

It should also offer the option to provide some sort of security around this such that not every identity in the orgs MSP can suddenly enable debug. Options that might be considered are

  1. an API Key that has to be passed in on the request, configured as part of the contract definition
  2. An explicit extended attribute in a certificate can be checked to see if that identity has the authority.

This should apply to all chaincode languages.