Difference between revisions of "USERLOG()"

From Lianjapedia
Jump to: navigation, search
m (1 revision)
 
Line 1: Line 1:
 
==Purpose==
 
==Purpose==
To log information to a user-specific log file for debugging or audit trail purposes.
+
To log information to a log file for debugging or audit trail purposes.
 
+
  
 
==Syntax==
 
==Syntax==
 
USERLOG(<expC>)
 
USERLOG(<expC>)
 
  
 
==See Also==
 
==See Also==
[[DB_USERLOG]], [[ERRNO()]], [[ERROR()]], [[LINENO()]], [[MESSAGE()]], [[ON ERROR]], [[RETRY]]
+
[[Database Events]], [[ERRNO()]], [[ERROR()]], [[LINENO()]], [[MESSAGE()]], [[ON ERROR]], [[SQL Constraints]]
 
+
  
 
==Description==
 
==Description==
The USERLOG() function is used to log information to a user-specific log file for debugging or audit trail purposes.  The USERLOG() function writes the specified character string <expC> into the file specified by the DB_USERLOG environment variable / symbol.
+
The USERLOG() function is used to log information to the user.log file for debugging or audit trail purposes.  The USERLOG() function writes the specified character string <expC> into the user.log file.
 +
 
 +
'''user.log file locations:'''
 +
 
 +
{| class="wikitable" width="100%"
 +
!width="30%"|Client||width="70%"|Location
 +
|-
 +
|valign="top"|Lianja App Builder||drive:\lianja\log\user.log
 +
|-
 +
|valign="top"|Lianja App Center (desktop client)||drive:\lianja\cloudserver\tenants\public\log\user.log
 +
|-
 +
|valign="top"|Web/Mobile Client||drive:\lianja\server\log\user.log
 +
|-
 +
|}
  
  
 
==Example==
 
==Example==
 
<code lang="recital">
 
<code lang="recital">
userlog("Entered Main Menu @ " + time())
+
//
</code>
+
// Database: dbcdoc
 +
// Event: dbc_beforeupdate
 +
//
 +
parameters cDatabase, cTable, cJSON
 +
userlog("====================================")
 +
userlog("Before Update in "+"dbcdoc database")
 +
userlog("Database: " +cDatabase)
 +
userlog("Table: " +cTable)
  
 +
if ! isserver()
 +
userlog("Update record number: " + etos(recno())
 +
for i = 1 to fldcount()
 +
if type("&(field(i))") = "G"
 +
loop
 +
endif
 +
userlog("Field: " + field(i))
 +
userlog("Curval(): " + etos(curval(field(i))))
 +
userlog("Value: " + etos(&(field(i))))
 +
endfor
 +
else
 +
userlog("JSON: " +base64_decode(cJSON)
 +
endif
 +
 +
userlog("End of Before Update")
 +
userlog("====================================")
 +
return .t.
 +
</code>
  
==Products==
 
Recital, Recital Server
 
 
[[Category:Documentation]]
 
[[Category:Documentation]]
 
[[Category:Functions]]
 
[[Category:Functions]]
 
[[Category:Error Handling and Debugging]]
 
[[Category:Error Handling and Debugging]]
 
[[Category:Error Handling and Debugging Functions]]
 
[[Category:Error Handling and Debugging Functions]]

Revision as of 06:28, 20 October 2016

Purpose

To log information to a log file for debugging or audit trail purposes.

Syntax

USERLOG(<expC>)

See Also

Database Events, ERRNO(), ERROR(), LINENO(), MESSAGE(), ON ERROR, SQL Constraints

Description

The USERLOG() function is used to log information to the user.log file for debugging or audit trail purposes. The USERLOG() function writes the specified character string <expC> into the user.log file.

user.log file locations:

Client Location
Lianja App Builder drive:\lianja\log\user.log
Lianja App Center (desktop client) drive:\lianja\cloudserver\tenants\public\log\user.log
Web/Mobile Client drive:\lianja\server\log\user.log


Example

//
// Database: dbcdoc
// Event: dbc_beforeupdate
//
parameters cDatabase, cTable, cJSON
userlog("====================================")
userlog("Before Update in "+"dbcdoc database")
userlog("Database: " +cDatabase)
userlog("Table: " +cTable)
 
if ! isserver()
	userlog("Update record number: " + etos(recno())
	for i = 1 to fldcount()
		if type("&(field(i))") = "G"
			loop
		endif		
		userlog("Field: " + field(i))
		userlog("Curval(): " + etos(curval(field(i))))
		userlog("Value: " + etos(&(field(i))))
	endfor
else
	userlog("JSON: " +base64_decode(cJSON)
endif
 
userlog("End of Before Update")
userlog("====================================")
return .t.