Log early messages with -printtoconsole #13088

pull ajtowns wants to merge 3 commits into bitcoin:master from ajtowns:earlyconsolelog changing 4 files +53 −39
  1. ajtowns commented at 12:12 pm on April 26, 2018: member
    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.
  2. fanquake added the label Utils/log/libs on Apr 26, 2018
  3. promag commented at 10:36 am on April 29, 2018: member
    Concept ACK.
  4. ajtowns force-pushed on May 3, 2018
  5. ajtowns commented at 2:09 pm on May 3, 2018: member
    Rebased on top of 12954 and 13148. Nitpicking welcome.
  6. 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.
  7. MarcoFalke added the label Refactoring on May 3, 2018
  8. MarcoFalke commented at 3:30 pm on May 3, 2018: member
    Noting that replacing the LogPrintf with FileWriteStr fixes #13157
  9. DrahtBot commented at 11:49 pm on July 22, 2018: member
  10. DrahtBot closed this on Jul 22, 2018

  11. DrahtBot reopened this on Jul 22, 2018

  12. MarcoFalke added the label Up for grabs on Jul 31, 2018
  13. ajtowns force-pushed on Aug 7, 2018
  14. ajtowns force-pushed on Aug 7, 2018
  15. ajtowns force-pushed on Aug 7, 2018
  16. ajtowns commented at 8:03 am on August 7, 2018: member
    Rebased, dropped overlapping commit with #13159 (which probably should be merged first), and note that CCriticalSection change introduces dependency loop.
  17. DrahtBot added the label Needs rebase on Aug 31, 2018
  18. Replace OpenDebugLog() with StartLogging()
    StartLogging() is used to mark the start of logging generically, whether
    using -printtoconsole or -debuglogfile.
    4348366585
  19. 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.
    bf6c20da4c
  20. 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.
    383e923372
  21. ajtowns force-pushed on Sep 3, 2018
  22. DrahtBot removed the label Needs rebase on Sep 3, 2018
  23. MarcoFalke removed the label Up for grabs on Sep 8, 2018
  24. MarcoFalke commented at 9:23 pm on September 9, 2018: member
    The tests seem to fail or deadlock
  25. DrahtBot commented at 10:38 pm on September 20, 2018: member

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    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= 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.

  26. 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? :-)
  27. 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:

    0        RecursiveMutex m_cs_log;
    
  28. MarcoFalke commented at 7:58 pm on January 16, 2019: member
    Needs rebase to have travis run again
  29. DrahtBot commented at 7:42 pm on February 4, 2019: member
  30. DrahtBot added the label Needs rebase on Feb 4, 2019
  31. ajtowns commented at 3:38 am on May 29, 2019: member
    Closing in favour of #16112
  32. ajtowns closed this on May 29, 2019

  33. MarcoFalke referenced this in commit 0853d8d2fd on Jun 18, 2019
  34. sidhujag referenced this in commit 6347640464 on Jun 19, 2019
  35. laanwj removed the label Needs rebase on Oct 24, 2019
  36. DrahtBot locked this on Dec 16, 2021

github-metadata-mirror

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: 2024-07-05 22:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me