USERLOG()

From Lianjapedia
Jump to: navigation, search

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.