Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Duplicate logging to stdout #8495

Merged
merged 2 commits into from
Mar 31, 2021
Merged

Duplicate logging to stdout #8495

merged 2 commits into from
Mar 31, 2021

Conversation

arkpar
Copy link
Member

@arkpar arkpar commented Mar 30, 2021

When logging to a file with additional logging targets set, it is useful to see basic progress and errors in the console. Substrate used to have this feature, but it was lost in a recent logging system refactoring. This PR restores it.

@arkpar arkpar added A0-please_review Pull request needs code review. B0-silent Changes should not be mentioned in any release notes C1-low PR touches the given topic and has a low impact on builders. D3-trivial 🧸 PR contains trivial changes in a runtime directory that do not require an audit labels Mar 30, 2021
client/tracing/src/logging/event_format.rs Outdated Show resolved Hide resolved
@bkchr bkchr requested a review from cecton March 30, 2021 14:14
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
event.metadata().level() == &Level::WARN ||
event.metadata().level() == &Level::ERROR
) {
let mut out = String::new();
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 in tracing they tried to avoid re-allocation using lazy_static. Probably for performance reasons... 🤔 but I can't find the code anymore

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

(Maybe it's not relevant here I don't know)

Copy link
Member Author

Choose a reason for hiding this comment

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

The string will only be allocated in the specific use case and only for INFO|WAR|ERROR messages that are rare. So I wouldn't bother.

@arkpar arkpar merged commit 70f1b61 into master Mar 31, 2021
@arkpar arkpar deleted the a-fix-logging branch March 31, 2021 10:46
ordian added a commit that referenced this pull request Mar 31, 2021
* master: (84 commits)
  Duplicate logging to stdout (#8495)
  Fix sync restart (#8497)
  client: fix justifications migration (#8489)
  helper macro to create storage types on the fly (#8456)
  Make `BlockImport` and `Verifier` async (#8472)
  Get rid of `test-helpers` feature in sc-consensus-babe (#8486)
  Enhancement on Substrate Node Template (#8473)
  Add Social Network (#8065)
  Prepare UI tests for Rust 1.51 & new CI image (#8474)
  Benchmarking pallet-example (#8301)
  Use pathbuf for remote externalities (#8480)
  Bring back the on_finalize weight of staking. (#8463)
  Implement `fungible::*` for Balances (#8454)
  make types within `generate_solution_type` macro explicit (#8447)
  [pallet-staking] Refund unused weight for `payout_stakers` (#8458)
  Use `async_trait` in sc-consensus-slots (#8461)
  Repot frame_support::traits; introduce some new currency stuff (#8435)
  Fix &mut self -> &self in add_known_address (#8468)
  Add NetworkService::add_known_address (#8467)
  Fix companion check (#8464)
  ...
arkpar added a commit that referenced this pull request Apr 5, 2021
* Duplicate logging to stdout

* Update client/tracing/src/logging/event_format.rs

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
hirschenberger pushed a commit to hirschenberger/substrate that referenced this pull request Apr 14, 2021
* Duplicate logging to stdout

* Update client/tracing/src/logging/event_format.rs

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A0-please_review Pull request needs code review. B0-silent Changes should not be mentioned in any release notes C1-low PR touches the given topic and has a low impact on builders. D3-trivial 🧸 PR contains trivial changes in a runtime directory that do not require an audit
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants