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 option for btcrpcclient as subsystem RPCC. #328

Merged
merged 1 commit into from Nov 19, 2015

Conversation

runeaune
Copy link
Contributor

This isn't really a subsystem, rather a dependency, but being able to
turn the logging on from the command line can greatly simplify debugging
of connectivity issues.

@jrick
Copy link
Member

jrick commented Nov 19, 2015

Nice find, without this all logs in the btcrpcclient package get eaten and there's no way of turning it back on.

ok

@davecgh
Copy link
Member

davecgh commented Nov 19, 2015

No real objections, although I wonder if the chain subsystem should tell the btcrpcclient to use its logger instead of having a separate subsystem? Allowing it to be specified separately doesn't hurt currently, but ultimately wallet will be able to work with both the current websockets RPC model as well as SPV in which case there will be no btcrpcclient dep.

EDIT: We can of course address that at the time SPV support gets merged as well.

@runeaune
Copy link
Contributor Author

I'll make it inherit chain's logger if you think that's better. The way I understand you, it will be set to whatever chain logging is set to, and not have it's own label. Is that correct?

@davecgh
Copy link
Member

davecgh commented Nov 19, 2015

Yeah it would all show up as "CHNS".

    case "CHNS":
        chainLog = logger
        chain.UseLogger(logger)
+       btcrpcclient.UseLogger(logger)

For what it's worth, I'm not really against it being like you have it now as a separate subsystem either, but I brought it up as a point of discussion since it might make sense to avoid a separate subsystem given the SPV plans.

What do you think @jrick?

@jrick
Copy link
Member

jrick commented Nov 19, 2015

Everything is set to the info level by default. If btcrpcclient shared the same logger as the chain package then there would be a lot more logging going on by default without any change in config. I'm not totally opposed to that but it depends how verbose it actually is.

@davecgh
Copy link
Member

davecgh commented Nov 19, 2015

The logging is quite light for info. I just took a look and there is only a single Infof message when the connection is established. The rest are Warnf when receiving malformed messages, which obviously should never happen on TCP unless the client/server don't agree on the format, Debugf for notification registrations, and Tracef for all commands and notifications. The Tracef messages could obviously get fairly noisy.

@jrick
Copy link
Member

jrick commented Nov 19, 2015

Seems that sharing the logger with chain would be ok then, except perhaps we want to remove the duplicate log when it connects ("Established websocket RPC connection to btcd").

@runeaune
Copy link
Contributor Author

Wouldn't that be the same if it's added with a separate subsystem label (assuming that the new label also defaults to info level)?

As for noise level, it seems pretty ok at info and above. Info level messages are logged for connect/disconnect only. As far as I can tell the biggest risk of log spam comes from warnings of invalid messages (eg. https://github.com/btcsuite/btcrpcclient/blob/master/notify.go#L199), although I don't know btcwallet well enough yet to judge how frequent those can be.

@runeaune
Copy link
Contributor Author

Sorry, didn't see Dave's reply before replying myself. I'm going to change
the logging to use chain's logger and remove the duplicate log for
connection to btcd.

On Thu, 19 Nov 2015 at 16:40 Josh Rickmar notifications@github.com wrote:

Seems that sharing the logger with chain would be ok then, except perhaps
we want to remove the duplicate log when it connects ("Established
websocket RPC connection to btcd").


Reply to this email directly or view it on GitHub
#328 (comment).

@davecgh
Copy link
Member

davecgh commented Nov 19, 2015

OK

@jrick
Copy link
Member

jrick commented Nov 19, 2015

ok.

Can you squash this into a single commit?

Logging from btcrpcclient is currently not possible to set, and defaults
to nothing. Letting it inherit chain's logger can greatly simplify
debugging of connectivity issues.

Also remove a now redundant log message upon connecting to btcd.
@runeaune
Copy link
Contributor Author

Sure.

@conformal-deploy conformal-deploy merged commit 52b8e19 into btcsuite:master Nov 19, 2015
jrick added a commit to jrick/btcwallet that referenced this pull request Aug 24, 2016
Add 'version: master' to all btcsuite and decred projects, since we
always want the latest versions of these.  This works around a bug in
the latest version of glide where it does not track the master branch
correctly.

Update gRPC for the 1.0.0 release and update bolt to 1.3.0 to pick up
a fix for a memory handling error that was exposed by the Go 1.7 SSA
compiler backend.

Fixes btcsuite#325.

Fixes btcsuite#328.
jrick added a commit to jrick/btcwallet that referenced this pull request Aug 24, 2016
Add 'version: master' to all btcsuite and decred projects, since we
always want the latest versions of these.  This works around a bug in
the latest version of glide where it does not track the master branch
correctly.

Update gRPC for the 1.0.0 release and update bolt to 1.3.0 to pick up
a fix for a memory handling error that was exposed by the Go 1.7 SSA
compiler backend.

Fixes btcsuite#325.

Fixes btcsuite#328.
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

Successfully merging this pull request may close these issues.

None yet

4 participants