Skip to content
This repository has been archived by the owner on Sep 26, 2019. It is now read-only.

[NC-1675] Reduce log levels #133

Merged
merged 4 commits into from
Oct 24, 2018
Merged

[NC-1675] Reduce log levels #133

merged 4 commits into from
Oct 24, 2018

Conversation

ajsutton
Copy link
Contributor

PR description

To make logs more useful and less verbose, reduce log level to debug in a number of places where the behaviour is expected and doesn't need to be in the default log output.


public class DetermineCommonAncestorTask<C> extends AbstractEthTask<BlockHeader> {
private static final Logger LOG = getLogger();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in some of these classes I'd put LogManager.getLogger(), in the future would it be better if I just out getLogger()?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer LogManager.getLogger. It gives a bit of context as to where the call comes from. After devcon I will likely do a large scale change and write an errorprone to pick a style and enforce it.

There is an errorprone check in the next release that checks for "confusing static imports." So ImmutableList.of cannot be statically imported. I don't know if getLogger was on the list but this one is common enough I think we should treat it as such.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also prefer LogManager.getLogger() and will go have a stern word with my IDE.

LOG.warn(
"Received Wire DISCONNECT, but unable to parse reason. Peer: {}",
LOG.debug(
"Received Wire DISCONNECT with invalid RLP. Peer: {}",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think its actually valid to send a disconnect message with no reason. We currently assume there is always a reason, so we get a parsing error when there is none. See: https://github.com/ethereum/devp2p/blob/master/devp2p.md:

reason is an optional integer specifying one of a number of reasons for disconnect

Might be worth adding a comment here and logging an issue.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good spot - I was wondering why so many clients were sending apparently invalid messages.


public class DetermineCommonAncestorTask<C> extends AbstractEthTask<BlockHeader> {
private static final Logger LOG = getLogger();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer LogManager.getLogger. It gives a bit of context as to where the call comes from. After devcon I will likely do a large scale change and write an errorprone to pick a style and enforce it.

There is an errorprone check in the next release that checks for "confusing static imports." So ImmutableList.of cannot be statically imported. I don't know if getLogger was on the list but this one is common enough I think we should treat it as such.

@ajsutton ajsutton merged commit c9fbc9d into PegaSysEng:master Oct 24, 2018
@ajsutton ajsutton deleted the less-logging branch October 24, 2018 20:11
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants