So I'm writing a program that needs to log pretty much everything it does. So whenever necessary I do an SQL insert to write some text to a log file. And there are a lot of logs to write per call - hundreds sometimes.
All those inserts will I'm sure affect performance a bit, and I would like to optimise it.
Now I could write the logs to an array DS and then insert them in bulk with "exec sql insert into log file :logcount rows values(:logDs)". But that means if the program crashed with a MSGW and then was cancelled, logs in the DS pending write may not get written. I could put everything in a monitor so it does not MSGW, but if a fatal error occurs I would want the job to stay in MSGW on the failed statement.
Any suggestions?
All those inserts will I'm sure affect performance a bit, and I would like to optimise it.
Now I could write the logs to an array DS and then insert them in bulk with "exec sql insert into log file :logcount rows values(:logDs)". But that means if the program crashed with a MSGW and then was cancelled, logs in the DS pending write may not get written. I could put everything in a monitor so it does not MSGW, but if a fatal error occurs I would want the job to stay in MSGW on the failed statement.
Any suggestions?
Comment