Hi, dear developers,
I noticed that at least some add-ons that are based on internet services are not able to deal with the loss of internet connectivity very well. Indeed they are spamming the openhab log with Java dumps. I noticed this behaviour with:
- Openhab Cloud Connector
- iCloud Connector
Why is this a problem? Most normal private internet connections receive a discconnect every night (to get a new IP adress from the provider). So each night my Openhab Cloudconnector complains broadly about the (intentioned) loss of connectivity. An error message would be fine, but a Java dump looks like a forgotten “error catch”.
I am curious if there is a reason for this behaviour and if I am the only one who sees a problem in that behaviour - a quick search through the community showed none results to me (although I might have chosen the wrong search terms).
Not here in the United States. This is the first time I have heard of this anywhere in the world. Since a large number of openHAB developers are in Germany (which, I assume, is where you are located) then I am sure it woul dhave been handled in the software.
If the ISP had short DHCP leases they could handle changing ip addresses without disconnects as long as they are not shuffling subnets around.
In Germany it’s normal to have a disconnect every day. My ISP does this at about 5’o clock in the morning.
When this happens my log gets spammed too. I noticed these bindings that complain about not having internet as well:
- Chromecast (since the Chromecast loses internet too)
This is what my logs look like in the morning…
In addition to the statement of Bruce, a system that is supposed to connect to the openHAB cloud SHOULD notify.
For the ERROR of the CloudConnector, do you have somehow enabled DEBGUG-logging? Because this “Java dump” is sent only in this case!
To clarify. The error stacktrace for the cloud connector should not be visible unless debug logging is enabled since openHAB 3 version of the cloud connector binding. If no debug logging is enabled it should not log the stacktrace in this specific case.
If logging stacktrace is not helpful this needs to be fixed on a case by case. So my suggestion is for those cases either create a pull request of an issue on GitHub. The solution would be to log to debug and (possible) update the thing state to offline.
In general it would be difficult to have some generic solution to not log in specific cases and to log in case when there is actually a problem as it’s not trivial to make that distinction.
NOTIFY: yes, most definately.
Put a complete Java Stack Trace into the logfile? Definately not.
I took a look into the log4j.xml. No DEBUG or TRACE entries there. Would have suprised me, since this is the brand new OH3 installation where I have not fiddled with logging at all at the moment.
I personally have the suspicion that the developers (naturally) use more the advanced logging possibilities on the console, so they do not notice the stack traces in the normal log file.
Generally I would consider those two default log files “openhab.log” and “events.log” as more kind of end-user relevant. So by default there should never appear a stack trace.
Indeed even during my days as a programmer (which are more than 20 years ago by now) I did not consider those stack traces as particullarily useful anyway, since in most cases the actual error has nothing to do with the lower parts of the stack.
And if I recall my Computer Science teachers correctly, the “pure doctrine” is to catch the error and either to react appropriately or at least write a meaningful error message (e.g. like in MS Windows: “An error occured!” )
Or worse, “You are not supposed to see this error”