Console application error handling

Hi

In my console application, there is a foreach loop, when processing each item in the array, if application get any php warning or notice entire process will stop and will not go for rest array items.I want to skip warnings ,notices and continue process all array items.By defining YII_ENABLE_ERROR_HANDLER to false will do the needful but it does not write to application log also, I want to keep them writing to application log.

Thanks

Can you try something like this?