Lower logging level at org.openhab.core.io.transport.modbus

Hi guys,

I’m developing some drivers for inverters using Modbus using the library org.openhab.core.io.transport.modbus. The situation is that the Class “ModbusSlaveConnectionFactoryImpl” throw errors with level ERROR and WARN in method “tryConnect”, and in my opinion should be a decision at the Binding level what to do and who to report it.

it is a very small change at the logger level with a huge impact on the logging process in our system.

I like to hear some feedback before proposing anything!

KR

I don’t understand your details, but careful about “hiding” Modbus connect errors. On a physical serial bus system in particular, failed connects can/will hog the bus while timeouts and retries take place, badly impacting performance on other devices. Don’t want that happening silently.

rossko57 thanks for the replay and sorry for not be able to make me clear!

I don’t want to hide the logs but the Modbus protocol, at least in my experience with my devices is not always the more stable and is misleading seen always as an ERROR on the device log only when is missing a connection or attempt. And anyway we will always receive this Exception back in the binding in the Callback function.

I would like to have the power to decide if reception is relevant or not in the different use cases.

Hi

The transport has the control for the duration of the retries, and binding takes over only later. I do not see how we can avoid logging in transport… What did you have in mind exactly?

Having said this, the binding and transport are probably too loud if we look at the guidance for developers Coding Guidelines | openHAB.

Most errors should be probably WARN at most. Instead of logging after every retry, we could summarize how many retries was attempted, leaving many unnecessary logging out. Binding currently is too loud logger, according to conventions above, we should not log anything if thing status is updated.

The transport has the control for the duration of the retries, and binding takes over only later. I do not see how we can avoid logging in transport… What did you have in mind exactly?

Log an Error every time that a try fail is IMO very loud, a WARN will be more than enough because in the end the failure/Exception will be thrown directly to the Binding.

I don’t know exactly what Binding you mind? org.openhab.binding.modbus

I use this lib in an internal development in may company.

Agreed that logging levels should be lower – as said, currently we are not following the logging guidelines even.

I would like that retries are not completely silent but perhaps retries could be summarized with one log statement after all retries have been exhausted or when attempt has been successful.

I’m happy to review and comment any possible PR w.r.t this topic. Just ping me in github (same username)

Note that there are several bindings using the transport, the “generic” org.openhab.binding.modbus is only one of them.

1 Like

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.