{"revision":"c10276e953456835cdbb1f3a60d58ae1980be353","document":{"id":619,"path":"api-reference/scripts/c_WritingToTheDebugLog.md","title":"Writing to the debug log","bundle":null,"doc_type":null,"release":"australia","body":"\n# Writing to the debug log\n\nTo write to the debug log in your client-side JavaScript, or UI policies, make a call to the global function `jslog()`.\n\nAn example of using `jslog()` in JavaScript:\n\n```javascript\nfunction logData (r ) {\n    lastLogDate  = r. responseXML. documentElement. getAttribute ( \"last_log_entry\" ) ; var items  = r. responseXML. getElementsByTagName ( \"log\" ) ;\n    jslog ( \"response=\" + r. responseText ) ; }\n```\n\nAdditionally, when client scripts run, the name of the client script and timing information is displayed. This can be useful in determining which scripts are running and whether they are impacting performance.\n\n**Parent Topic:**[JavaScript debug window](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/scripts/c_JavaScriptDebugWindow.md)\n\n## Debug UI policies\n\nEnabling the **glide.ui.ui\\_policy\\_debug** property lets you monitor the processing of UI actions.\n\nHere are some sample log events from an incident policy that sets fields to read-only if the incident\\_state is closed.\n\n```javascript\nGlideFieldPolicy: Evaluating condition\nGlideFieldPolicy:     incident_state (7) = 7 -> true\nGlideFieldPolicy: --->>> TRUE\nGlideFieldPolicy:    Setting opened_at disabled to true\nGlideFieldPolicy:    Setting opened_by disabled to true\nGlideFieldPolicy:    Setting closed_at disabled to true\nGlideFieldPolicy:    Setting closed_by disabled to true\nGlideFieldPolicy:    Setting company disabled to true\n\n```\n\n## Access the JavaScript log\n\nJavaScript that runs on the browser, such as client scripts, can include a call to jslog\\(\\) to send information to the JavaScript Log. Users with the admin role can access this log.\n\n### Before you begin\n\nRole required: admin\n\n### About this task\n\nThe steps to access the JavaScript debug window depend on which UI version you're using.\n\n**Note:** The JavaScript debug window is not supported with Next Experience. For more information about supported features in Next Experience, see [Considerations for activating Next Experience](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/platform-user-interface/next-experience-adoption-paths.md).\n\n### Procedure\n\n1.  Open the JavaScript log by navigating to the appropriate location for your version of the UI.\n\n<table id=\"simpletable_HowToOpenJavaScriptLogAndFieldWatcherInDifferentUIs\"><tbody><tr><td>\n\nCore UI\n\n</td><td>\n\n1.  Select the gear icon in the banner frame.\n2.  Select the **Developer** section.\n3.  Toggle the **JavaScript Log and Field Watcher** switch.\n\n\n</td></tr><tr><td>\n\nUI15\n\n</td><td>\n\n1.  Select the gear icon in the banner frame.\n2.  Select **JavaScript Log and Field Watcher**.\n\n\n</td></tr><tr><td>\n\nUI11\n\n</td><td>\n\nSelect the debug icon in the banner frame.\n\n</td></tr></tbody>\n</table>    A new pane opens at the bottom of the screen. It shows the JavaScript Log tab and may also show the Field Watcher tab.\n\n2.  If needed, select the **JavaScript Log** tab.\n\n3.  Select the clear icon to clear the contents of the log, as needed.\n\n\n"}}