Logging events in the application (trace)

The system table as_trace stores data on the operation of the application.

The code field determines which type of event:

  • DBLREQ - we fix the fact of multiple identical requests from the page in a short period of time (for example, if the form is placed in each row of the table)
  • EXCEPTION - исключение (ошибка) при работе программы
  • HUGE - a request with a large number of output lines (such requests can create a load on the processor)
  • NOTFOUND - passing to a non-existent page
  • PRINT - viewing the state of variables in stored procedures through execute as_print @str
  • PV - page visit. Fixing the user's visit to the page
  • REG - the fact of registration on the site (through as_trace_warn)
  • SEARCH - realization site search through the element at the top of each page
  • SF - safe form. Saving some form on the site
  • SLOW - fixing a slow Ajax request
  • SYNC - fixing the operation of periodic events (management in /syscp)
  • TG - events (errors) telegram

You can create your own event codes and write them in stored procedures through exec as_trace_warn

Request for statistics on trace elements (it is in the Diagnostics /diag): 

select 
  upper(isnull(code, '')) code,
  count(*) totalCount,
  isnull((select count(*) from as_trace t3 where t3.code=t1.code and cast(created as date) > cast(dateadd(month, -1, getdate()) as date) ), 0) [month],
  isnull((select count(*) from as_trace t3 where t3.code=t1.code and cast(created as date) > cast(dateadd(week, -1, getdate()) as date) ), 0) [week],
  isnull((select count(*) from as_trace t3 where t3.code=t1.code and cast(created as date) = cast(dateadd(day, -1, getdate()) as date) ), 0) yesterday,
  isnull((select count(*) from as_trace t2 where t2.code=t1.code and cast(created as date) = cast(getdate() as date) ), 0) today,
  isnull((select count(*) from as_trace t2 where t2.code=t1.code and created >  dateadd(hour, -1, getdate()) ), 0) lastHour,
  isnull((select count(*) from as_trace t2 where t2.code=t1.code and created >  dateadd(minute, -5, getdate()) ), 0) last5Min  
from as_trace t1
group by code
order by code

The as_trace table can be cleaned periodically. There is no need to save critical business data in it.

Falcon Space is a functional web development platform on a narrow stack MS SQL/Bootstrap. Falcon Space Gettting started
{sp-shortDemostandLinks}

Falcon Space Platform

This is a reduction in the cost of ownership

at the expense of fewer people to support

This is a quick change

while using the program

This is a modern interface

full adaptation for mobile devices

Note