среда, 30 апреля 2008 г.

Write InfoLog to database

There are several batch tasks running on the schedule in our company. They send many messages to InfoLog. Usually I am interesting messages of some type. It is not convenient scroll all messages in SysInfologBrowser form in search of required. I decided to implement the method for writing InfoLog to the database. After investigation of the Info class I wrote code listed below.

protected Log logTxt()

{

#resAppl

#Define.UserTab('\t')

Integer fromIdx = transLogPoint + 1;

Integer toIdx = infoLog.num();

SysInfoLogEnumerator enum = SysInfologEnumerator::newData(infoLog.copy(fromIdx, toIdx));

Log logTxt;

DictEnum dictEnum = new DictEnum(enumNum(Exception));
;
while (enum.moveNext())
{

logTxt += strFmt("%1 \t %2\r\n",

dictEnum.index2Name(enum.currentException()),
strRem(enum.currentMessage(), #UserTab));
}

transLogPoint = toIdx;

return logTxt;

}

Variable transLogPoint keep the value of the last message index before start batch task.

Комментариев нет:

Отправить комментарий