AXForum  
Вернуться   AXForum > Microsoft Dynamics AX > DAX Blogs
All
Забыли пароль?
Зарегистрироваться Правила Справка Пользователи Сообщения за день Поиск

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 18.03.2008, 17:05   #1  
Blog bot is offline
Blog bot
Участник
 
25,626 / 848 (80) +++++++
Регистрация: 28.10.2006
axStart: Application logging with stack traces integration.
Источник: http://axstart.spaces.live.com/Blog/...C0A0!282.entry
==============

Did we al have experienced the next example? A user complains that he received an error but he is not able to reproduce the error. In that case this small add on can help you out. The trick is that we gone log the error in the table of the long running queries. This integration is placed in the static error method of the global class. When the user is complaining about the error we can see it back in Administration\Inquiries\Databases\Sql Statement Trace Log. We can see the stack on tab page use and even jump to the code from that point.

X++:
client server static Exception error(SysInfoLogStr txt, URL helpUrl = '', SysInfoAction _sysInfoAction = null)
{
    //add on AXSTART.spaces.live.com
    #SysTrace
    container traceContainer;
    container  stack = xSession::xppCallStack();
    int        currentStack;
    str        result;
    ;
    //build memo field;
    for(currentStack = 1; currentStack <= conlen(stack); currentStack++)
    {
        if(currentStack mod 2 == 0)
            result += strfmt(' - line  %1 \n',conpeek(stack,currentStack));
        else
             result +=  conpeek(stack,currentStack);
    }
 
    traceContainer = conpoke(traceContainer, #SYS_TRACE_SQL_EXECUTION_PLAN,'');
    traceContainer = conpoke(traceContainer, #SYS_TRACE_SQL_EXECUTION_TIME,0);
    traceContainer = conpoke(traceContainer, #SYS_TRACE_SQL_CATEGORY,SqlTraceCategory::Statement);
    traceContainer = conpoke(traceContainer, #SYS_TRACE_SQL_STATEMENT,'');
    traceContainer = conpoke(traceContainer, #SYS_TRACE_SQL_TEXT,'');
    traceContainer = conpoke(traceContainer, #SYS_TRACE_SQL_TEXT_MORE,'');
    traceContainer = conpoke(traceContainer, #SYS_TRACE_SQL_CALLSTACK, result);
    traceContainer = conpoke(traceContainer, #SYS_TRACE_SQL_CODE,infolog.text() + '\n' + txt);
    SYSTraceTableSQL::CreateFromContainer(traceContainer);
    //add on AXSTART.spaces.live.com
 
    return infolog.add(Exception::Error, getprefix()+txt, helpUrl, _sysInfoAction, false);
}
This trick can also be used to monitor deeply changes of data. Of course this can also be done with database logging, but in that case I don’t have information about the process that changed the record. I used this when a customer was complaining that AX was changing the data, but on the end it was a user.

X++:
public void update()
{
    //add on AXSTART.spaces.live.com
    #SysTrace
    container traceContainer;
    container  stack = xSession::xppCallStack();
    int        currentStack;
    str        result;
    ;
    //build memo field;
    for(currentStack = 1; currentStack <= conlen(stack); currentStack++)
    {
        //skip line numers
        if(currentStack mod 2 == 0)
            result += strfmt(' - line  %1 \n',conpeek(stack,currentStack));
        else
             result +=  conpeek(stack,currentStack);
    }
 
    traceContainer = conpoke(traceContainer, #SYS_TRACE_SQL_EXECUTION_PLAN,'');
    traceContainer = conpoke(traceContainer, #SYS_TRACE_SQL_EXECUTION_TIME,0);
    traceContainer = conpoke(traceContainer, #SYS_TRACE_SQL_CATEGORY,SqlTraceCategory::Statement);
    traceContainer = conpoke(traceContainer, #SYS_TRACE_SQL_STATEMENT,'');
    traceContainer = conpoke(traceContainer, #SYS_TRACE_SQL_TEXT,'');
    traceContainer = conpoke(traceContainer, #SYS_TRACE_SQL_TEXT_MORE,'');
    traceContainer = conpoke(traceContainer, #SYS_TRACE_SQL_CALLSTACK, result);
    traceContainer = conpoke(traceContainer, #SYS_TRACE_SQL_CODE,strfmt('%1 changed to %2',this.orig().name , this.name);
    SYSTraceTableSQL::CreateFromContainer(traceContainer);
    //add on AXSTART.spaces.live.com
    super();
}
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
axStart: Type Save C# Ax 2009 integration Blog bot DAX Blogs 0 02.01.2009 15:05
Dynamics AX: Microsoft Dynamics AX - Application integration, BizTalk Adapter install possible error Blog bot DAX Blogs 0 26.08.2008 00:11
axStart: Office Com Integration Blog bot DAX Blogs 0 21.12.2007 04:11
Dynamics AX: Dynamics AX 4.0 - Application Integration Framework - Overview Blog bot DAX Blogs 0 28.10.2006 16:40

Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 22:45.