Correct
In each case, the
loggerName
parameter is combined with the stringorg.eclipse.smarthome.model.script.
to create the log4j logger name.
With the logger name one can configure how and how these log statements get logged out.
The second parameter is the information you want to log out. The statement you want to appear in the logs.
We need more information to understand what the problem is. The only way we can get more information is to print it to the logs, then compare what is printed to the actual code.
There are other ways to format what gets logged that you don’t have to worry about. For details see
If you are looking at openhab.log, you need to edit the log file config. See Log4j2 Sample Config.
But you don’t have to mess with any of that. Just use logInfo instead of logDebug.
rule "Window open NEW"
when
Member of gHContacts changed to OPEN
then
logInfo("Test", "Running Window openNEW Rule: EG_Vi_hkpump == " + EG_Vi_hkpump.state.toString)
if(EG_Vi_hkpump.state == OFF) return;
if(stopMotionTimer !== null) return;
logInfo("Test", "stopMotionTimer is null, proceeding to create the timer")
// Set the timer
stopMotionTimer = createTimer(now.plusMinutes(1) [|
logInfo("Test", "Inside the timer")
// Generate a list of all the open windows
var openWins = gHContacts.members.filter[ w | w.state == OPEN ]
logInfo("Test", "Open window Items: " + openWins)
var openWinsNames = openWins.map[ transform("MAP", "windows.map", name) ]
logInfo("Test", "Open window names: " + openWinsNames)
var openWinsMsg = openWinsNames.reduce[ msg, winName | msg + ", " + winName ]
logInfo("Test", "Open window message: " + openWinsMsg)
openWinsMsg = openWinsMsg.replaceFirst(", ", "") // delete the first comma
logInfo("Test", "Deleted the first comma: " + openWinsMsg)
openWinsMsg = openWinsMsg.replaceLast(", ", "und ") // replace the last comma with "und"
logInfo("Test", "Replaced last comma with und: " + openWinsMsg)
Echo_TTS.sendCommand("Die Heizung ist an. Bitte Fenster schließen im "/* + openWinsMsg + "."/*/)
logInfo("Test", "Sent message to the Echo")
stopMotionTimer = null
logInfo("Test", "Set the Timer to null")
])
logInfo("Test", "Rule is done")
end
Log everything.
Break up the long lines and log it at each stage.
The line with the error will be the line right after the last line logged. If you see “Set the Timer to null” in the log then the Rule and the Timer completed successfully.