Debugging Mobile Form

Logging in Mobile Form or any application for that matter is of utmost importance. It helps our customers in debugging the various issues in forms including performance. Mobile Form is a distributed application. It has a server component that generates data for the XFA runtime. XFA runtime is a javascript implementation of XFA reference that runs inside the browser and interprets the data generated by the Mobile Form server to render an XFA template and data in html5. In distributes scenario, logging helps a lot in keeping tab at what is going on at various sites.

Mobile Form has two distinct sites or two different components the Mobile Form server and XFA runtime.  One can configure Logger, individually (server and client), based on the requirements and set the levels for any specific request.

I will first describe on how to enable fine level logging in Mobile Form server and how to make sense out of it.

The steps are outlined as following:

  1. Go to http://<server>:<port>/lc/system/console/configMgr and look for “Apace Sling logging logger configuration” and click on it. You see a dialog like following:
  2. Select the Log Level to Debug.
  3. Specify a log file name. If you want to generate logs in the same directory i.e. <lc-install-dir>/crx-repository/logs, where other log files are kept then specify ../logs/<logfilename>.
  4. Specify Logger to HTMLFormsPerfLogger and save the configuration.

logconfig

 

That’s it. Now you can find the logs with performance for each render request. The log entries should look like the following:

04.07.2012 17:58:14.054 *DEBUG* [10.40.54.72 [1341404888673] GET /content/xfaforms/profiles/test.html HTTP/1.1] HTMLFormsPerfLogger !PERFORMANCE! <RenderOsgiServiceImpl.render>

04.07.2012 17:58:14.142 *DEBUG* [10.40.54.72 [1341404888673] GET /content/xfaforms/profiles/test.html HTTP/1.1] HTMLFormsPerfLogger !PERFORMANCE! <time>4004644004ns</time></RenderOsgiServiceImpl.render>

We are interested only in the last word of these log line. That will give you a valid xml file containing all the timings. Each label of the node represents the name of the API and <time> node contains the time taken by that API. You can use awk to generate that xml file. The following command would do: awk ‘{ print $11 }’ <logfilepath>

It is called perf logger because it generates performance information along with the trace. That is it about Mobile Form server logging. Now let’s move to client side logging.

There are two ways to enable XFA runtime client side logging. Like Mobile Form server logging, one way is to enable logs via configuration another via request parameter log. If you just want to generate logs for one particular request, you should use the 2nd approach i.e. pass the request parameter. The log parameter takes log configuration that is defined as follows:

{destination}-{a level}-{b level}-{c level}

For example:

Log Configuration Description
2-a4-b5-c6 Destination: Server
xfa level: INFO
xfaView level: DEBUG
xfaPerf level: TRACE

 

Let’s explore various constituents of log configuration. destination  is where log is redirected:

Log Destination

Log Destination Description
1 Logs are directed to the browser Console
2 Logs are collected in a JavaScript object on client side and can be posted to the Server
3 Both of the above options

 

Log Levels and Logger Categories are other constituents.

Log Levels

Log Level Description
0 OFF
1 FATAL
2 ERROR
3 WARN
4 INFO
5 DEBUG
6 TRACE
7 ALL

Logger Categories

Log Category Description
a xfa (Scripting engine related logs)
b xfaView (Layout engine related logs)
c xfaPerf (Performance related logs)

The default log level for each log category a (xfa), b (xfaView), and c (xfaPerf) is 2 (ERROR). Accordingly, for log configuration: 2-b6, the log levels for different categories are:

a (xfa): 2 (default level ERROR)
b (xfaView): 6 (user specified TRACE)
a (xfaPerf): 2 (default level ERROR)

 

You specify the log configuration using LC Forms Configuration:

  1. Search for and click LC Forms Configurations on http://<server>:<port>/lc/system/console/configMgr page.
  2. In the Debug Options text box, enter the log configurations as described in the previous section e.g. 2-a4-b5-c6.

 

using_config_mgr

 

If the destination is set as 1, all client script log messages are directed to the console. But at times Admin might need these logs along with server logs to co relate the two and for such cases destination level can be set to 2. At this level, all logs would be collected in a JS object on client side and if form is rendered with default Profile then a Send Logs button would appear to the left of Highlight Existing Fields button in toolbar. On click of this link all collected logs would be posted to the server and will be logged in the configured error log file on the server.

With ES4 SP1, you can also redirect client logs to a separate log file like Mobile Form server logs using the same steps mentioned to configure “Apace Sling logging logger configuration”  above in server logging section.

 

Leave a Reply

Your email address will not be published. Required fields are marked *


one + = 10

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>