![require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages](https://cdn.sanity.io/images/cgdhsj6q/production/be8ab80c8efa5907bc341c6fefe9aa20d239d890-1600x1097.png?w=400&fit=max&auto=format)
Security News
require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
@ampretia/ibp-chaincode-log
Advanced tools
tl;dr; simple command line tool to parse the chaincode logs from IBP to more readable form
npm install -g @ampretia/ibp-chaincode-log
kubectl --namespace=nbe307c logs org1peer-7ccbd7c5f6-7k55d -c chaincode-logs > ibp.log
ibpccl --file ibp.log
Pre-requsites: Node12, and a IBP chaincode_logs log file. Mostly easily obtained via kubectl
command line.
When running the test networks on your local machine, the output of the chaincode (smart contract) containers comes to the stdout/stderr of the docker container. You can watch this with docker logs -f xxxx
as you want.
IBP is deployed into a K8S cluster, and there are few more steps to get to the logs; they are also wrapped in a log file themselves.
kubectl
command line, from the IBM Kubernetes Cluster control panel, there's a 'Access via CLI' option that shows information on how setup the command line.kubectl get namespaces
command and guess. Will be something like nbe307c
nbe307c
. List the pods that are part of this namespace.kubectl --namespace=nbe307c get pods
NAME READY STATUS RESTARTS AGE
ibp-operator-58595bff67-bqlk7 1/1 Running 0 13d
orderingorgca-576b46cfc-kw4dj 1/1 Running 0 10d
orderingservicenode1-5f4cd9566f-4bbjj 2/2 Running 0 10d
org1ca-9b74dd4fd-7r5zh 1/1 Running 0 10d
org1peer-7ccbd7c5f6-7k55d 5/5 Running 0 10d
org2ca-6dcbf66d57-nnlmf 1/1 Running 0 10d
org2peer-65846466c4-8fxlg 5/5 Running 0 10d
This is the standard 2 organization network - and I know that I've install my contract onto both peers. Choose one of the pods that represents the peer, eg org1peer-7ccbd7c5f6-7k55d
kubectl --namespace=nbe307c logs org1peer-7ccbd7c5f6-7k55d -c chaincode-logs > ibp.log
ls -l ibp.log
-rw-rw-r-- 1 matthew matthew 145652 Jul 3 13:22 ibp.log
Install it with npm install -g @ampretia/ibp-chaincode-log
--file
option and the output will be parsed.ibpccl --file ibp.log
The output will be more familiar now, and easier to read.
The main issue with contracts not deploying correctly is some problem with they way they are built, maybe a compilation error, or missing file etc.
If you look in the parsed log, the container name is on each line after the timestamp, here it is 'nostalgic-dijkstra', and you can see the welcome message from Gradle.
(this naming convetioned is the the default of Docker containers if no name is given)
[2020-07-02T13:54:21.000Z nostalgic_dijkstra ] Welcome to Gradle 4.10.2!
Any container named like this will be one of the containers used to build the contract, and is a good starting point for errors.
FAQs
Helps parse chaincode logs from IBP
The npm package @ampretia/ibp-chaincode-log receives a total of 1 weekly downloads. As such, @ampretia/ibp-chaincode-log popularity was classified as not popular.
We found that @ampretia/ibp-chaincode-log demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.