added support to log to file throught environment variable