Rule debug logging is not showing in openHAB 2

I’m using openHAB 2.0 snapshot from earlier this month. I have rules configured to update a DateTime item when a switch’s state changes. The DateTime update is not working, so I’m now attempting to add some log debugging, but I can’t get that to work either.

My rule:

rule "Update N00014_PRS_Switch"
 when
  Item N00014_PRS_Switch changed
  logDebug("PRS","N00014 changed")
 then
  postUpdate(N00014_PRS_Time, new DateTimeType())
  logDebug("PRS","N00014 time updated")
end

I’ve set the log level for PRS to debug via:
log:set DEBUG org.eclipse.smarthome.model.script.PRS

but I don’t see any log info when tailing that log.

You cannot have a log statement in the when clause of the rule. I would expect to see errors in the openhab.log file indicating it couldn’t parse the .items file. But even without the error, the above is not syntactically correct so as far as OH is concerned the rule does not exist.

Just move the first logDebug statement after the then and it should work.

Great info, thanks. I’ve removed the log statement from the when clause. I still don’t see any logging info and the rule still doesn’t work.

If you would have moved the first logInfo to the position just after the “then”, you would see that logInfo in the log.
What is “new” support to be, a typo? Shouldn’t that be “now” ? And I’m not sure about the syntax you are using here, I’d declare the time variable before, set it to now ( if that is what you want) and use it after that in the postupdate.

Please try out the method, as I’m not sure, if the action would cast the correct type.

N00014_PRS_Time is of type DateTime?

rule "Update N00014_PRS_Switch"
when
    Item N00014_PRS_Switch changed
then
    logDebug("PRS","N00014 changed")
    N00014_PRS_Time.postUpdate(new DateTimeType())
    logDebug("PRS","N00014 time updated")
end

This worked! I’m seeing the logs now and the item is updating as expected. Thank you very much!

I have a simmilar issue and did not want to start a new thread.

I have an Item:

Switch Switch_Living "Livingroom Switch" { channel="homematic:HG-HM-SwI-3-FM:dinning:JEQ0272843:1#PRESS" }

which I want to use in a rule and see some log output. Some how I can not figure this out. My rule:

rule "Living Switch"
when
    Item Switch_Living changed
then
    logDebug("living", "Kitchen light turned on")
    logInfo("living", "test")
end

rule "Test Timer"
when
    Time cron "0 0/1 * * * ?"
then
    logInfo("living","Timer one Minute")
end

Addtionally I added an timer every Minute log. But neither is showing when I go to

 ssh openhab@localhost -p 8101

and enter
log:tail

Follwing addtional Info:

openhab> log:get
Logger | Level
--------------
ROOT   | INFO

But I entered:

openhab> log:set INFO org.eclipse.smarthome.model.script.living

Appretiate any help.