Port the node state logging change from 4.2-dev and trunk to now.