Added log file writing to the exception class.