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