Add logToFile method and log json requests