There are some PRs that I think are not yet merged that will let you set the logging level of openhab core as well as bindings through MainUI. Until that happens, you’ll have to use the Exec binding or executeCommandLine to issue the command.
Is it possible to supply openhab-cli with the password on the command line? Otherwise, I assume the exec binding will hang on the password request. Of course, this will expose a security hole but I don’t see another way.
That is a feature that i am looking forward to very much. If the logging level setting also does individual levels on scripts then it would be truly awesome
Have not done it, but in latest Milestones there is now a API explorer that guides you through what is possible with the API. This is found in the developer tools menu.
I don’t have a tutorial or example for that. But if you look in the API Explorer (Administration / Developer Tools / API Explorer) you can scroll down to /logging and see what is possible and what the correct format is. If you click on “Try it out / Execute”, you also see the corresponding curl command, that should be easily adaptable to the HTTP binding. Keep in mind that you need authentication for that, so either enable Basic Authentication or create an API Token.
Note the three different places where you have to set the logger name (commandTransformation, commandExtension, and stateExtension). You could add the logger name to the base url instead but then you would need a new thing for each logger. This way you just use one thing and each different logger is just a channel.
Also, as Jan said, you need an API token for authentication so make sure to create one first and put it in the username field.
As for the channel, the state half of the channel returns a JSON, so using the JSONPATH transform to extract the log level is trivial. The only slightly tricky part is that the command (Put) call expects a JSON payload. So there I use the REGEX transform to convert the single log level string into the appropriate JSON form. Now the channel receives a string and sends a JSON based on a string so I can just connect the channel to a string item with the following commandOptions: