now actually creating a log file and writing to it when preferred neighbors are changed