Can't log to debug log before chain params initialized #4534

pull laanwj wants to merge 3 commits into bitcoin:master from laanwj:2014_07_ui_log_exception changing 4 files +30 −13
  1. laanwj commented at 8:27 AM on July 15, 2014: member

    Calling LogPrintf() before SelectParamsFromCommandLine() resulted in an assertion, because it is not yet known what debug log to log to.

    Second commit replaces some UI LogPrintfs with qDebug().

  2. Can't log to debug log before chain params initialized
    Add a function `AreBaseParamsConfigured` and use this to check
    before writing to the debug log. This avoids assertions when the
    application happens to log too early, which happens in the GUI.
    
    Messages logged before the base parameters are configured can be
    shown using `-printtoconsole`.
    96ff9d6403
  3. ui: Replace some LogPrintfs with qDebug()
    These are relatively unimportant messages, so don't need to be logged
    without -debug=ui.
    c715ff52c7
  4. cozz commented at 12:39 PM on July 15, 2014: contributor

    Now bitcoin-qt --help prints

    ...
    UI options:
      -choosedatadir            Choose data directory on startup (default: 0)
      -lang=<lang>              Set language, for example "de_DE" (default: system locale)
      -min                      Start minimized
      -rootcertificates=<file>  Set SSL root certificates for payment request (default: -system-)
      -splash                   Show splash screen on startup (default: 1)
    ~BitcoinApplication : Stopping thread 
    ~BitcoinApplication : Stopped thread 
    

    I guess this is because of the second commit.

  5. laanwj commented at 1:38 PM on July 15, 2014: member

    Interesting. So qDebug() output goes to stdout/stderr as well?

    Edit: oh wait, this is before the messages are redirected.

  6. qt: Start core thread only when needed
    Start the core thread only when needed for initialization
    or shutdown.
    
    Avoids a bit of overhead, and also avoids spamming two
    log messages before logging is properly initialized.
    33357b27a0
  7. laanwj commented at 2:29 PM on July 15, 2014: member

    Ok, now avoiding starting the thread at all before it's needed. This makes it possible to leave the first commit out, although it may still be useful to prevent later surprises...

  8. BitcoinPullTester commented at 3:02 PM on July 15, 2014: none

    Automatic sanity-testing: PASSED, see http://jenkins.bluematt.me/pull-tester/p4534_33357b27a0f6e344e760caf87e96b577b4c25ad7/ for binaries and test log. This test script verifies pulls every time they are updated. It, however, dies sometimes and fails to test properly. If you are waiting on a test, please check timestamps to verify that the test.log is moving at http://jenkins.bluematt.me/pull-tester/current/ Contact BlueMatt on freenode if something looks broken.

  9. cozz commented at 3:47 PM on July 15, 2014: contributor

    Works for me now.

  10. laanwj merged this on Jul 17, 2014
  11. laanwj closed this on Jul 17, 2014

  12. laanwj referenced this in commit 66f3d0679f on Jul 17, 2014
  13. MarcoFalke locked this on Sep 8, 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: 2026-04-13 18:15 UTC

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