Thursday, March 15, 2012

AC: Server Side Javascript and Logging

Server Side Javascript

Recently Application Craft http://applicationcraft.com released Version 1.16.0 which includes Server Side Javascript. The docs state "Server Side Scripting is currently in Beta and is likely to remain in Beta until May 2012.".   You can read about SSJ here: Server Side Scripting.

One of the features I wanted to learn about is the use of debugging Logs and how it relates to SSJ. I found the following reference in the docs and thought it worth while to investigate: Writing to the Log:

Writing to the log is simple. You call one of the following functions
ssj.logSimple(title, description, instanceId, errorCode, tags);ssj.log( {title: "", description:””, instanceID:"", errorCode:"", tags:""} );
Both of these do the same thing. ssj.logSimple() expects a formal parameter list. ssj.log() expects an object, wherein some or all of the available parameters can be specified.

Some questions I had to ask were:
  • How are the logs defined?
  • How do I get access to the logs?
  • How can I display the logs content?
This blog will try to answer these questions.  


Some other things that you may learn:

  • How to create a SSJ script
  • How to invoke a SSJ function from the client
  • How to setup a Query and View
  • How to establish permissions for the Logs
  • How to write Javascript to access the data from the view and order it
  • How to populate a Grid component


The SSJ Log Viewer

The SSJ Log Viewer app can be viewed here:  SSJ Log Viewer



Enabling Logging and Queries/Views

The application must be setup to enable logging.  The steps are documented but, in my opinion, not straight forward in that there are little pieces here and there that have to all be done.  The following video will show the steps required to setup the application appropriately.

See AC - SSJ Logging

GitHub access

If you're interested in looking at this app, please reference it from GitHub https://github.com/bartonhammond/SSJ-Logging