Trying to feed rule result into loginfo line

I am trying to get the following rule to enter correctly in the OpenHAB log which door is opened. The sendMail line works great. I played around with it for awhile, but can’t figure it out. Any help would be appreciated.

rule "Entrance Door Opened"
       Item FrontDoor changed from CLOSED to OPEN or
       Item GarageDoor changed from CLOSED to OPEN or
       Item KitchenDoorWall changed from CLOSED to OPEN or
       Item OverHead2 changed from CLOSED to OPEN
       if(homeoraway.state == OFF) {       
          val dooropen = GEntranceDoors.allMembers.filter([s | s.state == OPEN]).sortBy([lastUpdate]).map[name + ": " + lastUpdate].join("\n")
          val message = "Security Alert.\nThe following Door was Opened:\n\n" + dooropen
          sendMail("", "Someone's Home", message)
         logInfo("Security", "Entrance Door Opened " + dooropen)

You only initialize dooropen in the block guarded by if(homeoraway.state == OFF). In other cases, the value will be undefined.

Thanks Steve for the quick response. That worked. I kept playing around with this to try and fix it but couldn’t figure out was wrong.