Log to file so logged output is still available after a crash. Closes issues #415.