@Martin I trust you , always have :-).
Coming to my issue , so what i did is created a method writeMessage2File(FilePath _filepath) and wrote this code, i am calling this method in every try & catch , in catch calling it before throw error line.
Objective of code is to collect all type of messages during execution & then write a file with all messages, warning, errors faced during execution.
So using AifInfoLog.getInfoLogData() i am trying to collect all infolog data in a container & then using TextIo, writing the container contents to a txt file.
Unfortunately It errors out at this line txIoWrite.write(conAllMessages); Error message is TextIo object not initialized.
protected void writeMessages2File(FilePath _filepath)
{
//Read logs & store in txt
AifInfoLog lAifInfoLog = new AifInfoLog();
TextIo txIoRead, txIoWrite;
FileIOPermission fioPermission;
container conAllMessages;
int xx,iConLength;
str sTempPath,sFileName = _filepath,sOneRecord;
;
//END Read logs & store in txt
conAllMessages = lAifInfoLog.getInfoLogData();
//containFromRead = Binary::constructFromContainer(containFromRead);
sTempPath = _filepath ;//WINAPI::getTempPath();
fioPermission = new FileIOPermission
(sTempPath sFileName ,"RW");
fioPermission.assert();
if (WINAPI::fileExists(sFileName))
{
WINAPI::deleteFile(sTempPath sFileName);
}
// Open a test file for writing.
// "W" mode overwrites existing content, or creates the file.
txIoWrite = new TextIo( sTempPath sFileName ,"W");
// Write records to the file.
txIoWrite.write("conAllMessages");
// Close the test file.
txIoWrite = null;
CodeAccessPermission::revertAssert();
info("Success");