Send log messages through server out file. Includes major refactoring.