The syntax of an explicit logging statement is:
Code Block |
---|
theme | Confluence |
---|
language | javascript |
---|
|
log <expr> |
where <expr>
is any valid KRL expression that results in a string (or something that can be cast as a string such as a number).
The following example would place a string with the value of a variable named query in the log if the rule fired:
Code Block |
---|
theme | Confluence |
---|
language | javascript |
---|
|
fired { log "query:"+query }
|
The following would only log with an empty query:
Code Block |
---|
theme | Confluence |
---|
language | javascript |
---|
|
fired { log "Empty query" if(query like "^$") } |
The following rule is selected when an http:post() event is raised indicating a error status code. The error is logged and then processing is stopped.
Code Block |
---|
theme | Confluence |
---|
language | javascript |
---|
|
rule r3 is active { |
...
select when http post label re#ex# status_code re#([45]\d\d)# |
...
...
noop();
fired {
log <<Error: #{status}: #{event:attr("status_line")}>> |
...
...
...
Another approach would use explicit error handling.