public void logRelays(Map<RelayMap, Boolean> statusRelayValue) {

        HashMap<Integer, Boolean> relayMapNow = new HashMap<Integer, Boolean>();
        boolean dirty = false;
        boolean shutdown = true;

        ArrayList<Temperature> temperaturesList = TemperaturesList.getInstance().list();

        // Read the relays...
        Iterator<Map.Entry<RelayMap, Boolean>> relayMapInterator = statusRelayValue.entrySet().iterator();
        while (relayMapInterator.hasNext()) {
            Map.Entry<RelayMap, Boolean> relayMapEntry = relayMapInterator.next();
            RelayMap relay = relayMapEntry.getKey();
            int idx = relay.getRelayDef().ordinal();
            relayMapNow.put(idx, statusRelayValue.get(relay));
            if (relayMapNow.get(idx) != relayMapLast.get(idx)) {
                // if any relay position changed then we want a log entry.
                dirty = true;
            }
            if (relayMapNow.get(idx)) {
                // if any relay is closed then we are not shutdown
                shutdown = false;
            }
        }

        // Do entry if dirty
        if (dirty) {
            StringBuffer sb = new StringBuffer();
            logHeader(sb);

            Iterator<Map.Entry<RelayMap, Boolean>> entryIterator = statusRelayValue.entrySet().iterator();
            while (entryIterator.hasNext()) {
                Map.Entry<RelayMap, Boolean> mapEntry = entryIterator.next();
                RelayMap relay = mapEntry.getKey();
                int idx = relay.getRelayDef().ordinal();
                String entry = relay.getRelayDef() + StringConstants.KeyValueDelimiter + relayMapNow.get(idx);
                sb.append(entry);
                sb.append(StringConstants.FieldDelimiter);
            }

            // add the string to our event list
            eventList.add(sb.toString() + temperaturesList.get(0).toString()
                    + StringConstants.FieldDelimiter + temperaturesList.get(2).toString()
                    + StringConstants.FieldDelimiter + temperaturesList.get(3).toString()
                    + StringConstants.FieldDelimiter + temperaturesList.get(1).toString());

            if (shutdown) {
                // the system just shutdown so record all the completed cycle's
                Iterator<String> it = eventList.iterator();
                while (it.hasNext()) {
                    logger.info(it.next());
                }
                eventList.clear();
            }
        }

        relayMapLast = relayMapNow;

    }