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. how to correct way log connection information from thread that continuously polling ?

how to correct way log connection information from thread that continuously polling ?

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 4 Posters 265 Views
  • 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.
  • Q Offline
    Q Offline
    Qt embedded developer
    wrote on last edited by
    #1

    i have one class where in thread a continuously polling happens.

    so in this continuously polling i am checking that connection gone a fail or not.

    so once it got fail i have to write when it get fail .

    Now after that if connection happens again then i have to write when connection get successfully start.

    How to achieve this goal ?

    Christian EhrlicherC 1 Reply Last reply
    0
    • Q Qt embedded developer

      @Christian-Ehrlicher

      yes i have done the log output. but query is that

      what condition i need to write to log information that correct way show that now my connection get stopped at 16:54:45 and after that if connection get started at 16:55:40 into thread that continuously polling the status connection

      because initially may be connection on. so if on then we continuously get on status.
      so at that time there is no need to log.

      But after that if connection lost then we get off status. so at that time only one time we need to write off status.

      Now After some times if we get connection get on so at that time we need to log that information only one time.

      after that if connection lost then we get off status. so at that time only one time we need to write off status.

      .
      .

      this things get repeats again and again based on connection status.

      So ultimately this is the goal i want to achieve from thread that continuously polling the connection at every one second.

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

      @Qt-embedded-developer Don't understand the problem. If state is on, log that and remember that you already logged on state. If state goes to off then log that and remember that you logged off state and also reset the variable holding on state to false, so next time you go to on state you log that. Just like @Christian-Ehrlicher told you.

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

      1 Reply Last reply
      1
      • Q Qt embedded developer

        i have one class where in thread a continuously polling happens.

        so in this continuously polling i am checking that connection gone a fail or not.

        so once it got fail i have to write when it get fail .

        Now after that if connection happens again then i have to write when connection get successfully start.

        How to achieve this goal ?

        Christian EhrlicherC Offline
        Christian EhrlicherC Offline
        Christian Ehrlicher
        Lifetime Qt Champion
        wrote on last edited by
        #2

        @Qt-embedded-developer said in how to correct way log connection information from thread that continuously polling ?:

        How to achieve this goal ?

        Remember if you already did a log output and if not then log.

        Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
        Visit the Qt Academy at https://academy.qt.io/catalog

        Q 1 Reply Last reply
        0
        • Christian EhrlicherC Christian Ehrlicher

          @Qt-embedded-developer said in how to correct way log connection information from thread that continuously polling ?:

          How to achieve this goal ?

          Remember if you already did a log output and if not then log.

          Q Offline
          Q Offline
          Qt embedded developer
          wrote on last edited by Qt embedded developer
          #3

          @Christian-Ehrlicher

          yes i have done the log output. but query is that

          what condition i need to write to log information that correct way show that now my connection get stopped at 16:54:45 and after that if connection get started at 16:55:40 into thread that continuously polling the status connection

          because initially may be connection on. so if on then we continuously get on status.
          so at that time there is no need to log.

          But after that if connection lost then we get off status. so at that time only one time we need to write off status.

          Now After some times if we get connection get on so at that time we need to log that information only one time.

          after that if connection lost then we get off status. so at that time only one time we need to write off status.

          .
          .

          this things get repeats again and again based on connection status.

          So ultimately this is the goal i want to achieve from thread that continuously polling the connection at every one second.

          jsulmJ JonBJ 2 Replies Last reply
          0
          • Q Qt embedded developer

            @Christian-Ehrlicher

            yes i have done the log output. but query is that

            what condition i need to write to log information that correct way show that now my connection get stopped at 16:54:45 and after that if connection get started at 16:55:40 into thread that continuously polling the status connection

            because initially may be connection on. so if on then we continuously get on status.
            so at that time there is no need to log.

            But after that if connection lost then we get off status. so at that time only one time we need to write off status.

            Now After some times if we get connection get on so at that time we need to log that information only one time.

            after that if connection lost then we get off status. so at that time only one time we need to write off status.

            .
            .

            this things get repeats again and again based on connection status.

            So ultimately this is the goal i want to achieve from thread that continuously polling the connection at every one second.

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

            @Qt-embedded-developer Don't understand the problem. If state is on, log that and remember that you already logged on state. If state goes to off then log that and remember that you logged off state and also reset the variable holding on state to false, so next time you go to on state you log that. Just like @Christian-Ehrlicher told you.

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

            1 Reply Last reply
            1
            • Q Qt embedded developer

              @Christian-Ehrlicher

              yes i have done the log output. but query is that

              what condition i need to write to log information that correct way show that now my connection get stopped at 16:54:45 and after that if connection get started at 16:55:40 into thread that continuously polling the status connection

              because initially may be connection on. so if on then we continuously get on status.
              so at that time there is no need to log.

              But after that if connection lost then we get off status. so at that time only one time we need to write off status.

              Now After some times if we get connection get on so at that time we need to log that information only one time.

              after that if connection lost then we get off status. so at that time only one time we need to write off status.

              .
              .

              this things get repeats again and again based on connection status.

              So ultimately this is the goal i want to achieve from thread that continuously polling the connection at every one second.

              JonBJ Offline
              JonBJ Offline
              JonB
              wrote on last edited by JonB
              #5

              @Qt-embedded-developer said in how to correct way log connection information from thread that continuously polling ?:

              But after that if connection lost then we get off status. so at that time only one time we need to write off status.
              Now After some times if we get connection get on so at that time we need to log that information only one time.

              This is all a very long explanation, but you need to implement @Christian-Ehrlicher's

              Remember if you already did a log output and if not then log.

              in some shape or form. So note if you "get off status" and do whatever you want about logging once that time or the next time it gets called, according as your desire. It's just about writing some code. Keep the state variable telling you what happened (e.g. disconnection) wherever appropriate, e.g. in a logging code class.

              1 Reply Last reply
              0

              • Login

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