Error Log Catching

On Sales Order line > Product and Supply > Configure Line

We are doing same process code in our customized code

this.configurelineprocess(xxx) ; // This is just to show we are using configuring process

How can i capture the error logs that occur during this process and save it in a table Error Log Table?

we are running this process in batch so in case if we had any errors during process we need to see those errors somewhere. So we need to capture the errors .

If you run it in batch, infolog messages are already logged. So maybe you don’t need any customization.

But if you want, you can record infolog messages by yourself. infolog.copy() gives you infolog messages; infologLine() gives you line numbers you need for that.

I am reading files from a folder and processing those using batch. I had a staging area of all the files that we read. So during batch job process if any error occurs i need to capture that and add it to staging area Error log . So user can go and click that record and check error log to find out what is the error?

Go to batch job history form, find the right record and press the Log button. It’ll display infolog messages captured during batch execution.

Other than that option you mentioned, there is no way i can capture error log during batch and save it in the error log table that i had ?

It is - it’s in the second paragraph of my first reply.

But you should write custom code only if the standard feature isn’t suitable. Note that you can also create custom form on the data collected automatically, instead of duplicating the logic.

The best code is code that you don’t have to design, write, debug and maintain. :slight_smile:

Ok Thanks. Will try what you mentioned and then will keep you posted.

We used Try and catch block, then like you said we used infolog.copy() and copied the messages inside that and looped through those messages and displaying it in the error log.