Reduce Logging in OH3

I have a lot of KNX channels which are causing a lot of ItemStateChangedEvent in the OH3 log. I fear that this will reduce my MicroSD card writes and that they will fail after a while.
Is there a way to disable e.g. ItemStateChangedEvent logging in the UI and only enable them again for debugging. Maybe this logging shall only be done if a certain user is logged in
What would be your proposal or do you even say, don’t worry about the log entries?

You can switch between info and debug level via console but you cannot customize logging to that extent you ask for.

Use openHABian, it has features to mitigate SD wearout.

You can disable ItemStateChangedEvent logging (which is excessive from my point of view) by setting the log-level of that class to WARN on the openHAB console by typing

log:set WARN org.openhab.core.items.events.ItemStateChangedEvent

and re-enable it with INFO instead of WARN. This might not survive an update, though.

Do you think that this also can be done in a rule?

log:set WARN org.openhab.core.items.events.ItemStateChangedEvent

I think this would be easier than always go to the console.

It does not make sense. By “update” @J-N-K refers to a software update so it’s not often at all.

But you’re heading into a dangerously wrong direction this is just creating pseudo safety.
Your post is making us victim to the XY problem here.
SD wearout is caused by way more causes and more intensively than by just logging, so tweaking that to whatever will NOT protect you from SD crashes to happen to any reasonable extent. More info here.
Drop that logging idea and go for a comprehensive solution.

1 Like

yes, it can be done from within a rule.
Example of running a console command from within a rule can be found here: Bash script execution from rule
For your use that echo command needs to be adapted.

Is there a chance to set the WARN level only for some dedicated items?

No.
But you can filter by Item