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

Update logging #919

Merged
merged 6 commits into from
May 16, 2018
Merged

Update logging #919

merged 6 commits into from
May 16, 2018

Conversation

abitmore
Copy link
Member

@abitmore abitmore commented May 13, 2018

This PR contains 2 changes:

  • log console output to file at same time by default, for easier trouble-shooting;
  • reduce default p2p log messages.

@abitmore abitmore added this to the 201805 - Non-Consensus-Changing Release milestone May 13, 2018
@oxarbitrage
Copy link
Member

please explain why this change. thanks.

@abitmore
Copy link
Member Author

OP updated.

@pmconrad pmconrad self-assigned this May 15, 2018
@abitmore
Copy link
Member Author

abitmore commented May 15, 2018

With current logging settings (before this PR), we need around 30GB of disk space for p2p log for first sync, and then around 200MB per hour which means 5GB per day, so need 35GB of disk space to store 7 days of log files (new default introduced in #840, was 1 day before that).

In this PR I changed default log level of p2p to warn.

  • Biggest part of log messages during first sync is "successfully pushed block X", whose level is info.
  • Biggest part of log messages during normal run (after synced) is the wdumps, which are likely for debugging, since there is no debug-dump macro, I changed them to idumps.
  • we have lots of other logging in info level, e.g. reporting status of all peers periodically.
  • IMHO some logging should be in warn level but not error level, e.g. unable to connect to a peer.

@abitmore
Copy link
Member Author

Another thing changed in this PR is that console logs will be saved to files at same time by default, which I've been using in production for years.

Copy link
Contributor

@pmconrad pmconrad left a comment

Choose a reason for hiding this comment

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

Perhaps also modify the default logging config for delayed_node (careful, interval and limit are hardcoded there)? Or should we deprecate the delayed_node executable?

@@ -260,7 +260,7 @@ namespace graphene { namespace net
}
catch ( fc::exception& e )
{
elog( "fatal: error connecting to peer ${remote_endpoint}: ${e}", ("remote_endpoint", remote_endpoint )("e", e.to_detail_string() ) );
wlog( "fatal: error connecting to peer ${remote_endpoint}: ${e}", ("remote_endpoint", remote_endpoint )("e", e.to_detail_string() ) );
Copy link
Contributor

Choose a reason for hiding this comment

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

Please remove "fatal" from the log message.

"filename=logs/default/default.log\n"
"# Rotate log every ? minutes, if leave out default to 60\n"
"rotation_interval=60\n"
"# how long will logs be kept (in days), if leave out default to 7\n"
Copy link
Contributor

Choose a reason for hiding this comment

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

Default limit is 1 not 7 (please also change in p2p appender). https://github.com/bitshares/bitshares-core/blob/develop/programs/witness_node/main.cpp#L367

"# declare an appender named \"default\" that writes messages to default.log\n"
"[log.file_appender.default]\n"
"# filename can be absolute or relative to this config file\n"
"filename=logs/default/default.log\n"
Copy link
Contributor

Choose a reason for hiding this comment

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

Perhaps better call it "node.log" or "chain.log"?

Copy link
Member Author

Choose a reason for hiding this comment

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

I named it default.log since it's written by the default logger in [logger.default] section.

@abitmore
Copy link
Member Author

@pmconrad thanks for the comments. I've made changes according to some of your comments.

In regards to the dedicated delayed_node binary, IIRC we're just keeping it for backward compatibility, so IMHO no need to "fix" it. Perhaps we need to update related documents, perhaps @cedar-book can take a look.

By the way, perhaps add rpc logging to config.ini so node admins will be aware of it? See #802.

@pmconrad
Copy link
Contributor

Yep, adding rpc logging to the default config would be a good idea.

@cedar-book
Copy link

cedar-book commented May 16, 2018

I had created this page (https://dev.bitshares.works/en/master/bts_guide/tutorials/index.html#api) before. Probably, I'll need to add the above information (PR and explanation) also (?)

@abitmore
Copy link
Member Author

@cedar-book new docs about logging is good. However we were talking about documentation about delayed_node.

"appenders=p2p\n\n";
"appenders=p2p\n\n"
"# route messages sent to the \"rpc\" logger to the \"rpc\" appender declared above,\n"
"# \"level\": \"error\" for errors only, \"warn\" for requests, \"info\" for responses.\n"
Copy link
Contributor

Choose a reason for hiding this comment

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

The level description is probably correct for the websocket api, but not for normal RPC. For simple requests with curl I didn't see responses being logged at level "info".

Copy link
Member Author

@abitmore abitmore May 16, 2018

Choose a reason for hiding this comment

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

Removed so far. IMHO we need a new issue to fix the inconsistency (update: here is it: #929).

@abitmore abitmore mentioned this pull request May 16, 2018
8 tasks
@abitmore abitmore merged commit 612f7f0 into develop May 16, 2018
@abitmore abitmore deleted the logging-change1 branch May 16, 2018 15:51
@abitmore abitmore mentioned this pull request May 21, 2018
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.

4 participants