How to set looging level in OH4


I tried to set the logging level for the Modbus binding, but it just has no effect.

First I I tried to set the level by navigating to Settings → Bindings → Binding Name and click the little gear icon in the upper right. In the Modbus binding then I see 7 addons. If I set the first “org.openhab.binding.modbus” to INFO, the 5 of 7 addons are also set to INFO. But whatevery I set, it has no effect. Is there a bug?

Then I went to “openhab-cli console”. Listed everything with “list -s”. Log level of modbus binding like almost other binding set to 80. Then I tried to set it with “log:set INFO org.openhab.binding.modbus”. “list -s” again, but still unchanged.

What am I doing wrong?

You’d have to use the “log:list” command on the console to see the actually used log-settings!

Setting a binding to INFO won’t show that much, I’d use a higher setting depending what you do need that for.

Ok, “log:list” gives the right information. I have set the Modbus binding to INFO: “log:set INFO org.openhab.binding.modbus”.
But I still get a lot of warnings from the binding. Do I need another approach, because it is related to “ing.ModbusSlaveConnectionFactoryImp” or “rt.modbus.internal.ModbusManagerImpl”?

2023-11-12 12:25:13.984 [WARN ] [ing.ModbusSlaveConnectionFactoryImpl]
2023-11-12 12:25:13.985 [WARN ] [ing.ModbusSlaveConnectionFactoryImpl]
2023-11-12 12:25:13.987 [WARN ] [rt.modbus.internal.ModbusManagerImpl]

This sets logging to a really low level. To not see the WARN messages, set the log level to ERROR.

Verbosity is raising

Yes of course. ERROR is right, “log:set ERROR org.openhab.binding.modbus”.
But this does not change anything, I still get all time these warnings :rofl:

2023-11-12 12:25:13.984 [WARN ] [ing.ModbusSlaveConnectionFactoryImpl]
2023-11-12 12:25:13.985 [WARN ] [ing.ModbusSlaveConnectionFactoryImpl]
2023-11-12 12:25:13.987 [WARN ] [rt.modbus.internal.ModbusManagerImpl]

I guess, you need to set

log:set WARN org.openhab.binding.ModbusSlaveConnectionFactoryImpl

But this is not available. When I call “log:list” I only see:

org.openhab.binding.modbus                         │ ERROR
org.openhab.binding.modbus.e3dc                    │ ERROR
org.openhab.binding.modbus.studer                  │ ERROR

Also in the binding configuration it is not available:

Let me check later with the sourcecode

Your warnings are coming from

So you would need to enter the following on the console

log:set ERROR

It’s now set to                    │ ERROR

But I still get these warnings:

2023-11-12 19:23:55.023 [WARN ] [ing.ModbusSlaveConnectionFactoryImpl] 
2023-11-12 19:23:55.025 [WARN ] [ing.ModbusSlaveConnectionFactoryImpl] 
2023-11-12 19:23:55.026 [WARN ] [rt.modbus.internal.ModbusManagerImpl]

Any further ideas?

Sorry, now I am completely out of ideas…

Edit: Sorry, typo from my side, missed the core, so it is

That’s it, the warnings are gone with this command :grinning: :grinning: Thanks!!

log:set ERROR

Do you know how this can be added to the Modbus Configuration page? Do I need to write an issue for this?

You cannot, as this belongs to the core io bundle, which is used in all the different modbus bindings.