Help with rule logging and item state

Hi all,

I’m trying to debug one of my rules, and I’m a bit puzzled about what’s going wrong. I basically tried to copy one of the sample rules

Here’s what I have:

rule "corLightOn"
when   
        Item FF_Hallway_Motion changed from OFF to ON 
then   
        logInfo('logLights', 'Hallway detected on with luminosity ', FF_Hallway_Lumin.state)
        if(FF_Hallway_Lumin.state < 40) {
                sendCommand(FF_Hallway_Light, 100)
        }
end

rule "corLightOff"
when   
        Item FF_Hallway_Motion changed from ON to OFF 
then   
	    logInfo('logLights', 'Hallway detected off with luminosity ', FF_Hallway_Lumin.state)
    	sendCommand(FF_Hallway_Light, 0)
end

The problem is that in the log I see:

12:10:28.856 [INFO ] [smarthome.event.ItemCommandEvent ] - Item 'FF_Hallway_Motion' received command ON 12:10:28.857 [DEBUG] [ding.zwave.handler.ZWaveThingHandler] - NODE 35: Command received zwave:device:157b8d41438:node35:sensor_binary --> ON 12:10:28.857 [WARN ] [ding.zwave.handler.ZWaveThingHandler] - Controller handler not found. Cannot handle command without ZWave controller. 12:10:28.857 [INFO ] [marthome.event.ItemStateChangedEvent] - FF_Hallway_Motion changed from OFF to ON 12:10:28.858 [INFO ] [pse.smarthome.model.script.logLights] - Hallway detected on with luminosity 12:10:28.863 [INFO ] [smarthome.event.ItemCommandEvent ] - Item 'FF_Hallway_Light' received command 100 12:10:28.863 [DEBUG] [ding.zwave.handler.ZWaveThingHandler] - NODE 34: Command received zwave:device:157b8d41438:node34:switch_dimmer --> 100 12:10:28.863 [WARN ] [ding.zwave.handler.ZWaveThingHandler] - Controller handler not found. Cannot handle command without ZWave controller. 12:10:28.864 [INFO ] [marthome.event.ItemStateChangedEvent] - FF_Hallway_Light changed from 0 to 100
i.e.
12:10:28.858 [INFO ] [pse.smarthome.model.script.logLights] - Hallway detected on with luminosity
doesn’t print the luminosity.

I can query it just fine from karaf
openhab> smarthome:status FF_Hallway_Lumin 7

What am I doing wrong? And is the WARNING something I should worry about?

Thanks!

the logInfo() is wrong :slight_smile: try it this way:

logInfo("logLights","Hallway detected on with luminosity {}", FF_Hallway_Lumin.state)

or

logInfo("logLights","Hallway detected on with luminosity " + FF_Hallway_Lumin.state.toString)

both should work.

Perfect! Thanks a lot!

BTW @udo_krueger, whilst I have your attention, am I right in thinking that logback.xml isn’t used in OH2? I can’t seem to find it anywhere, so I’ve been using karaf to set levels.

Yes, openHAB2 uses another logging mechanism, so there is no logback.xml