PB记录错误日志


li_file_no = FileOpen("system_error.log",LineMode!,Write!,Shared!,Append!)
if li_file_no = 0 then
    Messagebox("出错信息","不能打开系统出错日志文件!",Exclamation!)
else
    if FileWrite(li_file_no, "~r~n" + &
            "----------------------------------------------------------------" + &
                "~r~n" + &
                "~r~n 出错时间 : " + string(today(),'yyyy/mm/dd') + " " + string(now())+ &
                "~r~n 操作柜员 : " + gs_user_name + &
                "~r~n 错误代码 : " + string(error.number) + &
                "~r~n 错误信息 : " + error.text + &
                "~r~n 窗口/菜单: " + error.windowmenu + &
                "~r~n 出错控件 : " + error.object + &
                "~r~n 出错事件 : " + error.objectevent + &
                "~r~n 出错行数 : " + string(error.line) ) < 0 then
        MessageBox("出错信息","写系统出错日志文件出错!", Exclamation!)
    end if
end if
close(li_file_no)
PB