Log file writing added