This may be a little difficult to explain, so bear with me.
I have a small function that writes errors to a log table. I capture the ulink, the dynamicconnection string, an 'event type' (i define), a description (i also define), the current page, the user agent, the ip address, and finally the timestamp of the error.
An example would be
Which enters this into my table
I bold current page, because there is where my problem occurs.
Right now I'm using Request.Script_Name to get the script name.
If I run write2log within xbasic ON a a5w page, cur_page works correctly. However, if the write2log is within the xbasic IN a grid or dialog, I get the above __a5RunDialog.a5w as the cur_page. Which is, to my understanding, how the components are run. It is technically correct, but obviously, not what I want.
Looking through the Request variables page on the wiki: http://wiki.alphasoftware.com/Request+Object doesn't turn up anything I feel would be useful. The best solution would be to return the name of the component itself (prospects.a5wcmp, or whatever the component name is) Now, I suppose I could do write2log("Error in prospects") or something similar, but I'm hoping for something automated.
tl;dr
Request.Script_name returns __a5RunDialog.a5w instead of the actual page the component is on, which is probably correct, but not the 'intended' output
I have a small function that writes errors to a log table. I capture the ulink, the dynamicconnection string, an 'event type' (i define), a description (i also define), the current page, the user agent, the ip address, and finally the timestamp of the error.
Code:
FUNCTION write2log as v ( event as c, error as c = "" )
Code:
flag = globalcn.Execute("SELECT * FROM gen_employee WHERE ulink = '" + session.__protected__ulink + "'") if flag == .f. then write2log("SQL Error",globalcn.CallResult.text) end if
Code:
"ulink","5c51fe10-4c7f-4a0f-a99d-e89ea7cf2c83" "dyncon","nope", "event","SQL Error" "desc","The database could not find the data you requested" [B]"cur_page","/__a5RunDialog.a5w"[/B] "user_agent","Mozilla/5.0 (Windows NT 6.1; rv:8.0.1) Gecko/20100101 Firefox/8.0.1" "ip","nope" "modified_date","2012-07-19 13:34:22"
I bold current page, because there is where my problem occurs.
Right now I'm using Request.Script_Name to get the script name.
If I run write2log within xbasic ON a a5w page, cur_page works correctly. However, if the write2log is within the xbasic IN a grid or dialog, I get the above __a5RunDialog.a5w as the cur_page. Which is, to my understanding, how the components are run. It is technically correct, but obviously, not what I want.
Looking through the Request variables page on the wiki: http://wiki.alphasoftware.com/Request+Object doesn't turn up anything I feel would be useful. The best solution would be to return the name of the component itself (prospects.a5wcmp, or whatever the component name is) Now, I suppose I could do write2log("Error in prospects") or something similar, but I'm hoping for something automated.
tl;dr
Request.Script_name returns __a5RunDialog.a5w instead of the actual page the component is on, which is probably correct, but not the 'intended' output
Comment