Changed way the logging for subprocesses are performed and tried to make sure no log line is lost or truncated. Also did some cleanup