helium / miner

Miner for the helium blockchain
Apache License 2.0
607 stars 265 forks source link

Log to stdout/stderr? #617

Open adamklaff opened 3 years ago

adamklaff commented 3 years ago

It looks like the miner is hardcoded to use console.log and error.log as its logging output. When running in a docker container it would be nice to be able to set stdout and stderr as the logging output, and handle log file management upstream of the container.

evanmcc commented 3 years ago

this should be pretty easy to do by changing the lager backend in the config/docker.config file. just delete the file handlers and add the console backend at whatever level you want it at (probably info). docs for lager config can be found here: https://github.com/erlang-lager/lager

adamklaff commented 3 years ago

Thanks. I will try that. I didn’t want to have to maintain my own docker image but this could work.

evanmcc commented 3 years ago

I you think that this is the right way to do it in docker, @lthiery can check in with other docker users and we could potentially default to doing this.

adamklaff commented 3 years ago

Cool. There might be other ways and it's not a huge deal but from what I've read, console logging is a best practice for Docker:

https://www.papertrail.com/solution/tips/logging-in-docker-how-to-get-it-right/ https://www.reddit.com/r/docker/comments/del3xm/best_practice_docker_logging/

Vagabond commented 3 years ago

Yes, enabling the console log is the way we do it in other dockerized Erlang services. We disable it by default because stdio is relatively slow and we don't consume it in most of the existing deployment scenarios.

rafaribe commented 2 years ago

Yes, enabling the console log is the way we do it in other dockerized Erlang services. We disable it by default because stdio is relatively slow and we don't consume it in most of the existing deployment scenarios.

How much of a difference does it make to switch to stdio/stderr logs in docker? Genuinely curious about the performance difference vs logging into a file.