Debug logging in OH3?

I am afraid my last suggestion might not really solve your issue, as logging has changed completely.
You need to have the proper logging config file like @Mark_VG already wrote.
Events should be logged now with


openhab.event.ItemStateEvent │ INFO

Id have thought you’d get one out of the box, surely you can understand how something that should be so simple has become silly.

Like in MainUI, have a DROP down - lists currently installed bindings or preinstalled logging, select level, hit save. Dealing with OH has become like slamming my manhood in a car door in recent years!

Please see my last edit.
I am not shure why your restore corrupted your logging config, as it should not for my understanding.
Setting log levels through the UI is not that easy, that‘s why it is not implemented. You can either stop openHAB and edit the config file, or change it in Karaf console….

It depends on the order of operations I think. If you start with an OH 2.5 and upgrade that to OH 3, the logging and all the other files that can be upgraded will be upgraded. No problem, just a few breaking changes will be left that can’t be fixed automatically.

However, if you install OH 3 from scratch and then try to restore a backed up 2.5 config over that, there won’t be a chance to do any sort of upgrades on those configs because I believe it’s the installer that does the upgrades. All sorts of things will break because they will still refer to the OH 2.x package namespaces.

In the past I’ve had success editing the logger while OH is running. But I may have just been lucky.

You do get one out of the box. But because you tried to restore a config for an older OH version over a newer version it broke it. However, at least for the logging it might be really simple to get the stock logging config back.

Look in /ver/lib/openhab/etc/. You should see a log4j2.xml file. Look in it to make sure it’s not empty and all looks reasonable (i.e. no strange characters, truncated lines, stuff like that). That’s is the logging that comes with OH 3 out of the box.

Now edit the file org.ops4j.pax.logging.cfg and make it has just this one line.

org.ops4j.pax.logging.log4j2.config.file=${karaf.etc}/log4j2.xml

In OH 2 there was no log4j2.xml file. All the logging config was stored in that .cfg file. So luckily the restore didn’t cause you to completely lose the OH 3 config. You just overwrote that line that causes openHAB to load the config from the xml file.

1 Like

Thanks Rich! That fixed it!!! I can see all the item updates

Can this please please be added to the documentation - RESTORING FROM 2.5