added EnableLogging to enable/disable logging to file