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

Add logging on startup to stderr #3168

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

AbhinavMir
Copy link

fixes #3109 (fixes #3109)
kind:refactor

Replaced Println method with Infow from the go-log package for structured logging. P2P host information is now logged to stderr.

@github-actions github-actions bot added the external Issues created by non node team members label Feb 6, 2024
@Wondertan
Copy link
Member

It might look pretty ugly if we do it through logs due timestamps and other meta info. Could you check?

@AbhinavMir
Copy link
Author

AbhinavMir commented Feb 6, 2024

@Wondertan Makes sense, I just checked locally. With my modifications, locally it produces the following output:

docker run -e NODE_TYPE=light -e P2P_NETWORK=$NETWORK \
    celestia-node-local \
    celestia light init
Initializing Celestia Node with command:
celestia light init --p2p.network celestia
2024-02-06T22:03:09.307Z        INFO    node    nodebuilder/init.go:31  Initializing Light Node Store over '/home/celestia/.celestia-light'
2024-02-06T22:03:09.308Z        INFO    node    nodebuilder/init.go:63  Saved config    {"path": "/home/celestia/.celestia-light/config.toml"}
2024-02-06T22:03:09.308Z        INFO    node    nodebuilder/init.go:65  Accessing keyring...
2024-02-06T22:03:09.310Z        WARN    node    nodebuilder/init.go:194 Detected plaintext keyring backend. For elevated security properties, consider using the `file` keyring backend.
2024-02-06T22:03:09.311Z        INFO    node    nodebuilder/init.go:209 NO KEY FOUND IN STORE, GENERATING NEW KEY...    {"path": "/home/celestia/.celestia-light/keys"}

NAME: my_celes_key
ADDRESS: celestia1erykuyyfzvd79ktagx3sjffsgztczeh59d9ksc
MNEMONIC (save this somewhere safe!!!): 
..... some mnemonic

2024-02-06T22:03:09.325Z        INFO    node    nodebuilder/init.go:214 NEW KEY GENERATED...
2024-02-06T22:03:09.325Z        INFO    node    nodebuilder/init.go:72  Node Store initialized


Starting Celestia Node with command:
celestia light init

2024-02-06T22:03:09.361Z        INFO    node    nodebuilder/init.go:31  Initializing Light Node Store over '/home/celestia/.celestia-light'
2024-02-06T22:03:09.361Z        INFO    node    nodebuilder/init.go:63  Saved config    {"path": "/home/celestia/.celestia-light/config.toml"}
2024-02-06T22:03:09.361Z        INFO    node    nodebuilder/init.go:65  Accessing keyring...
2024-02-06T22:03:09.365Z        WARN    node    nodebuilder/init.go:194 Detected plaintext keyring backend. For elevated security properties, consider using the `file` keyring backend.
2024-02-06T22:03:09.368Z        INFO    node    nodebuilder/init.go:72  Node Store initialized

And, with the docker image, it outputs the following

docker run -e NODE_TYPE=light -e P2P_NETWORK=$NETWORK \
    ghcr.io/celestiaorg/celestia-node:v0.12.4 \
    celestia light init

Initializing Celestia Node with command:
celestia light init --p2p.network celestia
2024-02-06T22:03:40.013Z        INFO    node    nodebuilder/init.go:31  Initializing Light Node Store over '/home/celestia/.celestia-light'
2024-02-06T22:03:40.014Z        INFO    node    nodebuilder/init.go:63  Saved config    {"path": "/home/celestia/.celestia-light/config.toml"}
2024-02-06T22:03:40.014Z        INFO    node    nodebuilder/init.go:65  Accessing keyring...
2024-02-06T22:03:40.019Z        WARN    node    nodebuilder/init.go:194 Detected plaintext keyring backend. For elevated security properties, consider using the `file` keyring backend.
2024-02-06T22:03:40.019Z        INFO    node    nodebuilder/init.go:209 NO KEY FOUND IN STORE, GENERATING NEW KEY...        {"path": "/home/celestia/.celestia-light/keys"}
2024-02-06T22:03:40.039Z        INFO    node    nodebuilder/init.go:214 NEW KEY GENERATED...
2024-02-06T22:03:40.039Z        INFO    node    nodebuilder/init.go:72  Node Store initialized

NAME: my_celes_key
ADDRESS: celestia1jy63lv3jvejzty90w8klshrltmtgnfl0h9nu9k
MNEMONIC (save this somewhere safe!!!): 
....some mnemonic



Starting Celestia Node with command:
celestia light init

2024-02-06T22:03:40.069Z        INFO    node    nodebuilder/init.go:31  Initializing Light Node Store over '/home/celestia/.celestia-light'
2024-02-06T22:03:40.069Z        INFO    node    nodebuilder/init.go:63  Saved config    {"path": "/home/celestia/.celestia-light/config.toml"}
2024-02-06T22:03:40.069Z        INFO    node    nodebuilder/init.go:65  Accessing keyring...
2024-02-06T22:03:40.073Z        WARN    node    nodebuilder/init.go:194 Detected plaintext keyring backend. For elevated security properties, consider using the `file` keyring backend.
2024-02-06T22:03:40.076Z        INFO    node    nodebuilder/init.go:72  Node Store initialized

For whatever reason, I don't see other metadata being printed. Not sure if I messed something up while building the docker image locally. Any ideas Thanks!

@renaynay
Copy link
Member

renaynay commented Jul 5, 2024

It would look quite bad:

2024-07-05T15:22:57.224+0200	INFO	node	nodebuilder/node.go:130	The p2p host is listening on:
2024-07-05T15:22:57.224+0200	INFO	node	nodebuilder/node.go:132	* /ip4/10.10.2.89/tcp/2121/p2p/12D3KooWJY4HgQiM7Rv4Avyz3hCQictBLPF7rqh6Njbe7456W4Ec
2024-07-05T15:22:57.224+0200	INFO	node	nodebuilder/node.go:132	* /ip4/10.10.2.89/udp/2121/quic-v1/p2p/12D3KooWJY4HgQiM7Rv4Avyz3hCQictBLPF7rqh6Njbe7456W4Ec
2024-07-05T15:22:57.224+0200	INFO	node	nodebuilder/node.go:132	* /ip4/10.10.2.89/udp/2121/quic-v1/webtransport/certhash/uEiCfOr1eZdAB_lka20BRevaUyitTNSZztDvhLvfN5YjHXw/certhash/uEiA9NrvJ_DLVErRM3rTjO3Y5KMWhGal23wjrHXpe4CcN1g/p2p/12D3KooWJY4HgQiM7Rv4Avyz3hCQictBLPF7rqh6Njbe7456W4Ec
2024-07-05T15:22:57.224+0200	INFO	node	nodebuilder/node.go:132	* /ip4/24.40.157.2/tcp/2121/p2p/12D3KooWJY4HgQiM7Rv4Avyz3hCQictBLPF7rqh6Njbe7456W4Ec
2024-07-05T15:22:57.224+0200	INFO	node	nodebuilder/node.go:132	* /ip4/24.40.157.2/udp/61806/quic-v1/p2p/12D3KooWJY4HgQiM7Rv4Avyz3hCQictBLPF7rqh6Njbe7456W4Ec
2024-07-05T15:22:57.224+0200	INFO	node	nodebuilder/node.go:132	* /ip4/24.40.157.2/udp/61806/quic-v1/webtransport/certhash/uEiCfOr1eZdAB_lka20BRevaUyitTNSZztDvhLvfN5YjHXw/certhash/uEiA9NrvJ_DLVErRM3rTjO3Y5KMWhGal23wjrHXpe4CcN1g/p2p/12D3KooWJY4HgQiM7Rv4Avyz3hCQictBLPF7rqh6Njbe7456W4Ec
2024-07-05T15:22:57.224+0200	INFO	node	nodebuilder/node.go:132	* /ip4/127.0.0.1/udp/2121/quic-v1/webtransport/certhash/uEiCfOr1eZdAB_lka20BRevaUyitTNSZztDvhLvfN5YjHXw/certhash/uEiA9NrvJ_DLVErRM3rTjO3Y5KMWhGal23wjrHXpe4CcN1g/p2p/12D3KooWJY4HgQiM7Rv4Avyz3hCQictBLPF7rqh6Njbe7456W4Ec
2024-07-05T15:22:57.224+0200	INFO	node	nodebuilder/node.go:132	* /ip6/::1/tcp/2121/p2p/12D3KooWJY4HgQiM7Rv4Avyz3hCQictBLPF7rqh6Njbe7456W4Ec
2024-07-05T15:22:57.224+0200	INFO	node	nodebuilder/node.go:132	* /ip6/::1/udp/2121/quic-v1/p2p/12D3KooWJY4HgQiM7Rv4Avyz3hCQictBLPF7rqh6Njbe7456W4Ec
2024-07-05T15:22:57.224+0200	INFO	node	nodebuilder/node.go:132	* /ip6/::1/udp/2121/quic-v1/webtransport/certhash/uEiCfOr1eZdAB_lka20BRevaUyitTNSZztDvhLvfN5YjHXw/certhash/uEiA9NrvJ_DLVErRM3rTjO3Y5KMWhGal23wjrHXpe4CcN1g/p2p/12D3KooWJY4HgQiM7Rv4Avyz3hCQictBLPF7rqh6Njbe7456W4Ec

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
external Issues created by non node team members
Projects
None yet
Development

Successfully merging this pull request may close these issues.

fix(node): Log node p2p information to stderr as well so docker runners can see it
3 participants