wiki:UnifiedLogger

Version 3 (modified by jdalbey, 7 years ago) (diff)

draft

Unified Logging Service

We've created a subsystem of the simulator to provide a real time monitor of student interactions with the system for instructors to view to facilitate assessment of student actions.

We call it a "unified" logging service because it combines logs from several different sources into a single log. Currently it combines input from:

  • CAD comment logs (generated by CAD server)
  • CMS messages (generated by CPTMS)

and in the near future

  • HAR messages (generated by CPTMS)
  • Activity Logs (generated by Activity Logger web app)
  • Instructor Comments & Evaluations (generated by EI Notebook)

The output is a CSV file, unifiedlog.csv, which merges all the previous logs and orders them by simulation time.

A separate web app, unifiedlogmonitor.html, runs in a web browser to display a nicely formatted version of the CSV file.

Configuration

A single configuration file, loggingservice.cfg, resides in the simulation config folder.

[Paths]
UnifiedLogPath = webapps/dynamicdata/

The only option is to specify the path to the folder in which the output CSV file is to be created. This will change between dev and production systems; the production system will expect the file to exist on the apache server.

Packaging

The source code is in the src/python/unifiedlogger folder. The package.sh script found in that folder should be run to package the source files into a zip file and place it in the deploy folder.

Testing

Attached to this page are test data files: CADlogTestdata.txt and CMSlogTestdata.txt.

Save the first one in the trunk folder and rename it to CADcomments.log

Save the second one in webapps/dynamicdata and rename it to cms_messages.json

Open a terminal in the trunk folder and start the application: python deploy/unifiedlogger.zip

The application will echo logs to the console for diagnostic purposes.The expected output file is unifiedlog_expected.csv (attached). It should match the actual results in unifiedlog.csv.

While the application is running you may append further entries to either data file, save it, and observe the output csv file is updated with the new entry.

(TBD: explain time interval.)

Open webapps/unifiedlogmonitor.html in a web browser and observe the csv file listed in reverse chronological order, formatted like this:

example

Usage

Start the CAD server and Simulation Manager. Load the practice script and start it running. Start a CAD client. In a browser, start CPTMS. In a browser, start unifiedlogmonitor.html.

Wait for an incident to appear in the CAD client. Open the incident viewer and in the upper comments field, enter a note "hello world" and press Exit/Send?.Wait ten seconds and observe an entry for CAD Log appear in the monitor.

In CPTMS, display the CMS layer, open a CMS dialog and enter a message "SLOW TRAFFIC". Click "Send" and wait ten seconds. Observe an entry for CMS Activated to appear in the monitor. Update the CMS message results in a "CMS Updated" entry in the unified log. Clearing a CMS message results in a "CMS Deactivated" entry in the unified log.

Running as a background service

TBD: Explain how to start the service as a unix daemon. Explain start, stop, restart. Explain which files are reset, etc.

Attachments