You have been redirected from an outdated version of the article. Below is the content available on this topic. To view the old article click here.

log()

Usage

log(objects...)

Description
Prints a string representation of the given objects to the Structr log file. This method can be used to create debugging output in scripting context without impacting the output or functionality of the page rendering.

Example

${log('Hello, world')}

results in the output of

Dec 12, 2015 6:11:29 PM org.structr.core.parser.Functions$74 apply
INFO: Hello, world

in the structr log file.

Search results for "log()"

changelog()

Returns the changelog for a specific entity. See Changelog for details on what the contents of a changelog are.

The resolve parameter controls if remote entities are resolved. Every changelog entry which has a target will be resolved as targetObj (if the remote entity still exists in the database).

Filtering (supported from version 2.2)
All filter options are chained using the boolean AND operator. Only changelog entries matching all of the specified filters will be returned.
For filter keys which can occurr more than once, the filter values are combined using the boolean OR operator (see examples 1 and 2)

Filter Key Applicable Changlog verbs (*) Changelog Entry will be returned if max. occurrences
timeFrom (**) create, delete, link, unlink, change timeFrom <= time of the entry 1 (***)
timeTo (**) create, delete, link, unlink, change timeTo >= time of the entry 1 (***)
verb create, delete, link, unlink, change verb of the entry matches at least one of the verbs n (****)
userId create, delete, link, unlink, change userId of the entry matches at least one of the userIds n (****)
userName create, delete, link, unlink, change userName of the entry matches at least one of the userNames n (****)
relType link, unlink rel of the entry matches at least one of the relTypes n (****)
relDir link, unlink relDir of the entry matches the given relDir 1 (***)
target create, delete, link, unlink target of the entry matches at least one of the targets n (****)
key change key of the entry matches at least one of the keys n (****)

(*) If a filter parameter is supplied, only changelog entries can be returned to which it is applicable. (e.g. combining key and relType can never yield a result as they are mutually exclusive)
(**) timeFrom/timeTo can be specified as a Long (time in ms since epoch), as a JavaScript Date object, or as a String with the format yyyy-MM-dd'T'HH:mm:ssZ
(***) The last supplied parameter takes precedence over the others
(****) The way we supply multiple occurrences of a keyword can differ from StructrScript to JavaScript

changelog(entity [, resolve=false [, filterKey1, filterValue2 [ , ... ] ] ] )
$.changelog(entity [, resolve=false [, map]])

log()

Prints a string representation of the given objects to the Structr log file.

log(objects...)

serverlog()

Returns the last n lines from the server log file

serverlog([lines = 50])

user_changelog()

Returns the changelog for the changes a specific user made.

user_changelog(user [, resolve=false [, filterKey1, filterValue2 [ , ... ] ] ] )
$.user_changelog(user [, resolve=false [, map]])

Logging

nodeextender.log Enables the logging of generated Java code of the dynamic schema entities to the logfile. This setting allows you to investigate and debug the generation of Java code for your schema entities in cases where something goes wrong.
nodeextender.log.errors Enables the logging of Java compilation errors when compiling the dynamic schema of your application.
log.requests Enables full request logging for all requests handled by Structr. Caution, the log file can get very large when a lot of requests with lots of content are made.
log.debug Controls the debug() built-in function, which will behave exactly like the log() function if enabled.
log.functions.stacktrace Enables stacktrace logging for script calls and built-in functions. If enabled, a scripting error will write the full Java stack trace to the logfile.
log.prefix Sets the prefix for the request log file that is written when log.requests is enabled.
log.javascript.exception.request Adds path, queryString and parameterMap to JavaScript exceptions (if available) if enabled.
log.directorywatchservice.scanquietly Prevents logging of each scan process for every folder processed by the directory watch service.

Changelog

The changelog itself can be retrieved using the builtin changelog() function. The changelog is written to disk at changelog.path with the subfolders n for nodes and r for relationships. If user-centric changelog (application.changelog.user_centric.enabled) is enabled the changelog is written to the subfolder u. In older versions of structr the changelog was written to the structrChangeLog property of a node. The following tables show the possible keys/values of modification records. Modification records are stored as a JSON string. (see the example below)