Suppose i am processing 100 records and for every record processed i want to log the data into a log file.After all the records are processed i should have a log file indicating which records were processed and which were were not

Typically I would create a separate file to store this information. Each time you loop through your process, record the case information and whether it was successful or whether there was an exception.