Conditions and Log file

Added conditions and output to a log file when process has to be
stopped.