Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

where to view the chaincode log #6

Closed
yqbjtu opened this issue Aug 29, 2016 · 4 comments
Closed

where to view the chaincode log #6

yqbjtu opened this issue Aug 29, 2016 · 4 comments

Comments

@yqbjtu
Copy link

yqbjtu commented Aug 29, 2016

I write some chaincode and deploy it . but there is some results, which is not my expected. I add some log to chiancode as debug info like "fmt.Println("id:" + args[0] + " - state" + args[1])", after I enter into the docker by "docker exec -it xxxx bash", then can't find where the chaincode log is.

Thank you!

@yeasy
Copy link
Owner

yeasy commented Aug 29, 2016

see through the docker-compose start cli.
or use docker-compose logs -f where the docker-compose.yml stays.

@yqbjtu
Copy link
Author

yqbjtu commented Sep 2, 2016

Thank you very much! "docker-compose logs" does show the log

I use
var logger = shim.NewLogger("BienChaincode")
func main() {
logger.SetLevel(shim.LogInfo)
err := shim.Start(new(BienChaincode))
if err != nil {
fmt.Printf("Error starting BienChaincode chaincode: %s", err)
}
}

then call logger.Infof("init logger arg0=%s", args[0])

when I used the
peer chaincode deploy -p ./ -c '{"Function":"init", "Args": ["hi there2"]}' -u jim

to deploy the chaincode, in the container interal, it seem that "docker-compose logs" can't show the log.

@yeasy
Copy link
Owner

yeasy commented Sep 2, 2016

yes, in that case, you should find your chaincode container id by docker ps, then use

docker logs -f chaincode_container_id

@yqbjtu
Copy link
Author

yqbjtu commented Sep 4, 2016

Thank you very much! I get the logs

@yqbjtu yqbjtu closed this as completed Sep 4, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants