Hello,

What are best practices to generate a bad items file? I have several Jobs, that read a file (FlatFileItemReader) then these items may be processed and finally written in other file, on a data base, etc.

Then problem is I need to generate a .bad file with all the records with problems. That problems can be originated on the read, process o write part. And this file must contain the original flat record

I successful extract the original flat record when the problem is originated in the reader, using a skipListener and the FlatFileParseException. But when the problem isn't in the reader, but in the process or in the writer i don't know how to get the original flat record. I'm only have the object.

What is the best approach to resolve this problem? maybe implementing a custom FlatFileItemReader and put the original line in the StepContext? Or there is other trick?

Thanks a lot