Openhab 4 log debug doesn't work anymore

I used the following code to log events,

this.log = Java.type("org.slf4j.LoggerFactory").getLogger("org.openhab.model.script.Rules.Update_Regen_24hrs");
this.log.debug("Last24hours: {}", last24hours);

but after upgrading OH4.0.1 to OH4.0.2 it stopped working for



still works.

I guess the log level was reset as I had to clear the cache and tmp (require for homekit troubleshooting)

I’m just wondering for which process I have to enable the debug mode?

org.openhab.automation.jsscripting                    │ DEBUG
org.openhab.automation.script                         │ DEBUG
org.openhab.core.model.rule                           │ DEBUG
org.openhab.core.model.script                         │ DEBUG
org.openhab.core.model.script.Rules                   │ DEBUG
org.openhab.core.model.script.actions.ScriptExecution │ DEBUG
org.openhab.core.model.script.rules                   │ DEBUG

I tried console.debug and it works.
However using this command would require to change all my scripts :frowning:

Any hint what I have to change to get the debug output again?

many thanks

No, that’s not what caused it. What probably happened is your log4j2.xml file got updated after the upgrade. There were required changes to the logging config a lot of people where missing because they kept their old configs instead of adopting the new ones.

It’s based on the name of the logger and you are explecitely setting that name to “org.openhab.model.script.Rules.Update_Regen_24hrs”.

Assuming you use the same naming scheme in all your rules, set the level for “org.openhab.model.script” and it should change it for all your rules.

1 Like

Many thanks Rich - you saved my weekend :slight_smile:

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.