Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Possible to track program progress before crash using QFile or maybe QSettings?
Forum Updated to NodeBB v4.3 + New Features

Possible to track program progress before crash using QFile or maybe QSettings?

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 2 Posters 1.0k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    Crag_Hack
    wrote on last edited by
    #1

    Hi I'd like to have my program record its progress using either QFile or QSettings (or something better if it exists...). So if the program crashes progress is recorded and its easy to see where the crash occurred. Do QFile and QSettings guarantee completion of their corresponding operations before subsequent instructions are performed? Is there another way or better way of doing things?

    jsulmJ 1 Reply Last reply
    0
    • C Crag_Hack

      Hi I'd like to have my program record its progress using either QFile or QSettings (or something better if it exists...). So if the program crashes progress is recorded and its easy to see where the crash occurred. Do QFile and QSettings guarantee completion of their corresponding operations before subsequent instructions are performed? Is there another way or better way of doing things?

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by jsulm
      #2

      @Crag_Hack Why use QFile for that? QSettings isn't designed for something like this at all. It is used to read/write settings, not for logging. You can simply use qDebug/qWarning to log some information. Then you can forward the output to a file when needed:

      my_app.exe > some.log
      

      If you really need a logging solution take a look at Qt Logging Framework: http://doc.qt.io/qt-5/qmessagelogger.html

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      1
      • C Offline
        C Offline
        Crag_Hack
        wrote on last edited by
        #3

        Thanks jsulm. Hmmm... are either of those solutions good for non-local debugging? Like a customer's computer is crashing and need to figure out why. Will redirecting qDebug output work for a gui program as well? How about catching a bug that's not easily reproducible?

        jsulmJ 1 Reply Last reply
        0
        • C Crag_Hack

          Thanks jsulm. Hmmm... are either of those solutions good for non-local debugging? Like a customer's computer is crashing and need to figure out why. Will redirecting qDebug output work for a gui program as well? How about catching a bug that's not easily reproducible?

          jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @Crag_Hack Redirecting output of a GUI app works in the same way as for a console app. Your requirements sound like you need a logging framework. Take a look at what Qt provides or any other logging framework for C++. For debugging crashes core dumps are helpful.

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          1

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved