From UI, you can only set add-on log level (coming with openHAB 4). but not generally for all scripts. You may use the REST API endpoint (available since openHAB 3.3.0), use Developer Tools → API Explorer → logging.
@rlkoshak Do you think changing log levels from scripting is a common task? If yes, we should probably provide an action to do that.
I can’t imagine it would be common, but I can see some cases where a user detects some problem (e.g. a Thing went offline) and wants to capture some trace logging when they restart the binding through a script or something like that.
I personally would probably use this in the ~Scratchpad~ occasionally to turn up the logging on a rule I’m debugging.
As I think about all the ways people control the logging in their rules, I think I could see this being appreciated as part of the library. But in my case, it’s not just changing the logging level of the current rule/script but being able to change any arbitrary logger’s level.