Error logging

Log error into text file in production mode