Added capability to log messages to a file instead of stdout