This allows any log messages sent prior to the -printtoconsole option being parsed to be replayed onto the console. This could be handy if option parsing (parameters/config file) wants to output any warnings or info messages.
Log early messages with -printtoconsole #13088
pull ajtowns wants to merge 3 commits into bitcoin:master from ajtowns:earlyconsolelog changing 4 files +53 −39-
ajtowns commented at 12:12 PM on April 26, 2018: contributor
- fanquake added the label Utils/log/libs on Apr 26, 2018
- ajtowns cross-referenced this on Apr 26, 2018 from issue New -includeconf argument for including external configuration files by kallewoof
-
promag commented at 10:36 AM on April 29, 2018: member
Concept ACK.
- ajtowns force-pushed on May 3, 2018
-
ajtowns commented at 2:09 PM on May 3, 2018: contributor
Rebased on top of 12954 and 13148. Nitpicking welcome.
-
MarcoFalke commented at 2:56 PM on May 3, 2018: member
Is this of any relevance? I had the impression that parameter interaction was done after logging was set up.
- MarcoFalke added the label Refactoring on May 3, 2018
- MarcoFalke cross-referenced this on May 3, 2018 from issue test: Handle timestamps without microseconds in combine_logs by laanwj
-
MarcoFalke commented at 3:30 PM on May 3, 2018: member
Noting that replacing the
LogPrintfwithFileWriteStrfixes #13157 - DrahtBot cross-referenced this on Jun 14, 2018 from issue [bugfix] Fix encoding issue for Windows by ken2812221
-
DrahtBot commented at 11:49 PM on July 22, 2018: contributor
<!--5d09a71f8925f3f132321140b44b946d-->The last travis run for this pull request was 80 days ago and is thus outdated. To trigger a fresh travis build, this pull request should be closed and re-opened.
- DrahtBot closed this on Jul 22, 2018
- DrahtBot reopened this on Jul 22, 2018
- DrahtBot cross-referenced this on Jul 25, 2018 from issue [WIP] Full unicode support on Windows by ken2812221
- DrahtBot cross-referenced this on Jul 28, 2018 from issue Test for Windows encoding issue by ken2812221
- sipa cross-referenced this on Jul 30, 2018 from issue Ignore unknown config file options; warn instead of error by sipa
- MarcoFalke added the label Up for grabs on Jul 31, 2018
- DrahtBot cross-referenced this on Aug 1, 2018 from issue Include tinyformat as a subtree by Empact
- DrahtBot cross-referenced this on Aug 2, 2018 from issue Include tinyformat as a subtree by Empact
- DrahtBot cross-referenced this on Aug 2, 2018 from issue Move src/tinyformat.h to src/tinyformat/tinyformat.h by Empact
- ajtowns force-pushed on Aug 7, 2018
- ajtowns force-pushed on Aug 7, 2018
- ajtowns force-pushed on Aug 7, 2018
- DrahtBot cross-referenced this on Aug 10, 2018 from issue use a pretty ascii art to distinguish executions in debug.log by scravy
- DrahtBot cross-referenced this on Aug 11, 2018 from issue refactor: Removal of circular dependency between index/txindex, validation and index/base by mgrychow
- DrahtBot cross-referenced this on Aug 13, 2018 from issue Introduce MempoolObserver interface to break "policy/fees -> txmempool -> policy/fees" circular dependency by Empact
- DrahtBot cross-referenced this on Aug 23, 2018 from issue Utxoscriptindex by mgrychow
- DrahtBot added the label Needs rebase on Aug 31, 2018
-
4348366585
Replace OpenDebugLog() with StartLogging()
StartLogging() is used to mark the start of logging generically, whether using -printtoconsole or -debuglogfile.
-
bf6c20da4c
Log early messages with -printtoconsole
This ensures log messages prior to StartLogging() are replayed to the console as well as to the debug log file.
-
383e923372
logging.cpp: use CCriticalSection instead of std::mutex
Note: this introduces a circular dependency between logging and sync, since sync does logging, and logging does synchronisation.
- ajtowns force-pushed on Sep 3, 2018
- DrahtBot removed the label Needs rebase on Sep 3, 2018
- DrahtBot cross-referenced this on Sep 7, 2018 from issue Process logs in a separate thread by jamesob
- DrahtBot cross-referenced this on Sep 8, 2018 from issue add -debuglogsize=<n> option by SuckShit
- MarcoFalke removed the label Up for grabs on Sep 8, 2018
-
MarcoFalke commented at 9:23 PM on September 9, 2018: member
The tests seem to fail or deadlock
-
DrahtBot commented at 10:38 PM on September 20, 2018: contributor
<!--e57a25ab6845829454e8d69fc972939a-->
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
<!--174a7506f384e20aa4161008e828411d-->
Conflicts
Reviewers, this pull request conflicts with the following ones:
- #15329 (Fix InitError() and InitWarning() content by hebasto)
- #15266 (memory: Construct globals on first use by MarcoFalke)
- #14169 (add -debuglogsize=<n> option by SuckShit)
- #13949 (Introduce MempoolObserver interface to break "policy/fees -> txmempool -> policy/fees" circular dependency by Empact)
- #10443 (Add fee_est tool for debugging fee estimation code by ryanofsky)
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.
- DrahtBot cross-referenced this on Sep 21, 2018 from issue Add fee_est tool for debugging fee estimation code by ryanofsky
-
in test/lint/lint-circular-dependencies.sh:15 in 383e923372
11 | @@ -12,6 +12,7 @@ EXPECTED_CIRCULAR_DEPENDENCIES=( 12 | "chainparamsbase -> util -> chainparamsbase" 13 | "checkpoints -> validation -> checkpoints" 14 | "index/txindex -> validation -> index/txindex" 15 | + "logging -> sync -> logging"
practicalswift commented at 5:51 PM on October 10, 2018:What would be required to avoid introducing this circular dependency? :-)
in src/logging.h:64 in 383e923372
60 | @@ -59,9 +61,10 @@ namespace BCLog { 61 | class Logger 62 | { 63 | private: 64 | - FILE* m_fileout = nullptr; 65 | - std::mutex m_file_mutex; 66 | - std::list<std::string> m_msgs_before_open; 67 | + CCriticalSection m_cs_log;
MarcoFalke commented at 7:58 PM on January 16, 2019:nit:
RecursiveMutex m_cs_log;MarcoFalke commented at 7:58 PM on January 16, 2019: memberNeeds rebase to have travis run again
DrahtBot commented at 7:42 PM on February 4, 2019: contributor<!--cf906140f33d8803c4a75a2196329ecb-->Needs rebase
DrahtBot added the label Needs rebase on Feb 4, 2019MarcoFalke cross-referenced this on May 28, 2019 from issue util: Log early messages by MarcoFalkeajtowns closed this on May 29, 2019MarcoFalke referenced this in commit 0853d8d2fd on Jun 18, 2019sidhujag referenced this in commit 6347640464 on Jun 19, 2019laanwj removed the label Needs rebase on Oct 24, 2019bitcoin locked this on Dec 16, 2021ContributorsLinked (view graph)#10267 New -includeconf argument for including external configuration files#13157 test: Handle timestamps without microseconds in combine_logs#13159 Don't close old debug log file handle prematurely when trying to re-open (on SIGHUP)#13799 Ignore unknown config file options; warn instead of error#16112 util: Log early messages
This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-05-19 06:54 UTC