API: Log
Filename:
fwpLog_err.ctag
Released With:
5.0.0
Current Version:
1.0.1
Status: Active
Min Lasso Tested: 8.1.0
Max Lasso Tested: 8.5.3
Related:
Still don't get it?
Check out the talk list archives, or join and ask your questions.
Documentation Error or Request?
Email documentation corrections or comments
Writes to a tab delimited log file or database table certain page and error status information about Lasso, the pageblocks framework, and application specific errors. The tag is automatically executed by the error manager fwpErr_mngr.lgc. Logging can be turned on|off by setting the variable $fw_gLogErr to true|false. Text file rolling can be set to annual, monthly, weekly, or daily by setting the variable $fw_gLogErrRoll to 'A|M|W|D'. The log can be directed to a text file or a data table by setting the variable $fw_gLogErrTarget to 'file|database'.
Every error handled by the error manager is assigned a random string ID code. This ID can be shown to end users of the site for reference in emails to tech support which can then look for that code in the log.
The following items are logged (with tab separators if text file used):
id = a generated error log line ID
code = the framework or Lasso error code
[server_date: -extended]
[server_time]
[Client_IP]
[Response_FilePath]
[Referrer_URL]
errorMsg = and FWPro generated error message
pageInfo = custom notation about the current page
fwpInfo = custom notation about the current framwork status
[fwpLog_err: -id = string, -code = string, -errorMsg = string, -pageInfo = string, -fwpInfo = string]
-id - required : a unique identifier ID for the log entry
-code -required : the error code of the error being logged
-errorMsg - required : an explanatory message string for the error being logged
-pageInfo - required : custom misc info about the page. This is picked up by setting the variable $fw_logPageInfo to whatever is desired throughout the application on a per page basis. The default entry is "n/a" unless changed. This is particularly useful in editing systems like the event driven pages (EDP) framework where the same page name is used, but actually several different displays are possible. This input can be used to identify exactly which display the current page is using.
-fwpInfo - required : custom misc info about the current framework tag (if applicable). This is set by the internal framework code by setting the variable $fw_logFWPInfo to reflect what tag is active which can provide additional debugging info. The default entry is "n/a" unless changed. This capability was added in version 3.2, but hasn't been fully utilized in all tags yet.
From the fwpErr_mngrFWP.lgc error handler:
var: 'fw_errCode' = integer:($fw_errPair->first), 'fw_errStr' = $fw_errPair->second, 'fw_errLogID' = (fwpStr_randomID:9); if: ($fw_gLogErr); fwpLog_err: -id = $fw_errLogID, -code = $fw_errCode, -errormsg = $fw_errStr, -pageInfo = $fw_logPageInfo, -fwpInfo = $fw_logFWPInfo; /if;
<?lassoscript
//............................................................................
//
// pageblocks: (c) 2002-2007 http://www.pageblocks.org/
//
//............................................................................
/*
{fileName= fwpLog_err.ctag }
{rsrcType= tag }
{rsrcName= fwpLog_err }
{rsrcHTTP= www.pageblocks.org/refc/fwpLog_err }
{lassoVrsnMin= 8.1.0 }
{lassoVrsnMax= 8.5.3 }
{author= Greg Willits }
{authorEmail= subscribe to pbTalk at www.pageblocks.org/talk/ }
{authorHTTP= www.pageblocks.org }
{desc= Creates a log of FWPro and Lasso errors. }
{maintvsrn= 1.1.1 }
{maintrelease= 5.2.4 }
{maintdate= 2007-07-21 }
{maintauthor= Greg Willits }
{maintnotes= added tagTacer }
{maintvsrn= 1.1 }
{maintrelease= 5.2.0 }
{maintdate= 2007-06-09 }
{maintauthor= Greg Willits }
{maintnotes= added log_critical }
{maintvsrn= 1.0.1 }
{maintrelease= 5.0.0 b5 }
{maintdate= 2006-02-02 }
{maintauthor= Greg Willits }
{maintnotes= changed db/tbl references to use new vars }
{maintvsrn= 1.0 }
{maintrelease= 5.0.0 }
{maintdate= 2006-01-16 }
{maintauthor= Greg Willits }
{maintnotes= initial release }
*/
//.............................................................................
define_tag:'fwpLog_err',
-autooutput,
-priority='replace',
-optional='id',
-optional='code',
-optional='errorMsg',
-optional='pageInfo',
-optional='fwpInfo';
$fw_debug >= fw_kChatty ? $fw_tagTracer->(add:'fwpLog_err', -errorMsg=local:'errorMsg');
local:'fw_logFileNm'=($fw_sPath->'logs') + 'errlog_' + (date->year);
// backwards compatibility
// doesn`t require the declaration of fw_gLogErrTarget
if: !(global_defined:'fw_gLogErrTarget');
$fw_gLogErrTarget = 'file';
/if;
if: $fw_gLogErrTarget == 'file';
inline:
-username=$fw_gFilesUser,
-password=$fw_gFilesPswd;
select: $fw_gLogErrRoll;
case:'M';
#fw_logFileNm += '_m' + (date->month);
case:'W';
#fw_logFileNm += '_w' + (date->week);
case:'D';
#fw_logFileNm += '_d' + (date->dayofyear);
/select;
#fw_logFileNm += '.txt';
log: #fw_logFileNm;
#id;
'\t';
#code;
'\t';
server_date: -extended;
'\t';
server_time;
'\t';
client_IP;
'\t';
response_filepath;
'\t';
referrer_URL;
'\t';
#errorMsg;
'\t';
#pageInfo;
'\t';
#fwpInfo;
'\n';
/log;
$fw_criticalLog && ((file_currentError: -errorcode) != 0)
? log_critical:('pbError : fwpLog_err -- ' + file_currentError);
/inline;
else: $fw_gLogErrTarget == 'database';
local:'logPairs' = (array:
'logErrID' = #id,
'logErrCode' = #code,
'logDate' = server_date: -extended,
'logTime' = server_time,
'logClientIP' = client_IP,
'logPageURL' = response_filepath,
'logPageRef' = referrer_URL,
'logErrMsg' = #errorMsg,
'logPageInfo' = #pageInfo,
'logFWPInfo' = #fwpInfo);
fwpLog_asyncSQL:
-logPairs = #logPairs,
-user = $fw_gQueryUser,
-pswd = $fw_gQueryPswd,
-db = $fw_gDatabases->find:'logs',
-tbl = $fw_gTables->find:'logerr',
-keyfld = 'id';
/if;
/define_tag;
?>
© 2002-2012, pageblocks.org