logging of widget's script or expression evaluation

urs_h_

15-10-2015

I would like to log the evaluation of a widget's initialization script, value commit script, calculate expression, visibility expression, access expression, validation expression etc.

Is there any possibility to log (to javascript console) when what script or expression is evaluated and what the result of the evaluation is?

Accepted Solutions (0)

Answers (3)

Answers (3)

rishim22446870

15-10-2015

To enable logging follow these steps

a) Navigate to system console [1]
b) Search for the service DAY CQ HTML Library Manager (or Granite HTML Library Manager) and open the settings for the same
c) Check the checkbox which says Debug Console
d) In the text box which says Debug Init Script define a js variable window.AF_log_config with the value "a7-b7-c7-d7". To know what this value represents have a look at Log Configuration[2]
e) Save the settings.
f) Open any Guide and the logger will be enabled

Note: Support for sending logs to server is not available

[1] http://<server_name>:<server_port>/system/console/configMgr

[2] https://helpx.adobe.com/aem-forms/6/html5-forms/enable-logs.html

urs_h_

15-10-2015

Thank you, Rishi. Yes I'm referring to adaptive form expressions. Your answer is helpful.

In guideRuntime.js there is logger instance. I asked myself whether there is an easy way to configure this logger that it automatically logs the evaluation of the scripts and expressions.

rishim22446870

15-10-2015

Hello,

Your question arise's mainly from the perspective of debugging Adaptive form expressions right ? If yes, as of today there is no OOTB support to debug expression, but you can make use of the in-build browser support to add a javascript breakpoint during code exection [1] using the debugger; keyword. For Example,

Say, you are writing a calculate expression to compute a field's value, then you can add debugger; keyword before the actual business logic,

debugger; textbox.value

Hope this answer's your questions. Let me know if you need any further help.

[1] https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/debugger