Replace call to deprecated temp file method
Log exception stack trace