Table of Contents
The Tutor Logging API, provided by the DataShop, is a Java package intended to make the logging of tutor messages easier for anyone developing a tool, tutor, or authoring tool using Java. This API follows the tutor_message_v4.xsd schema which is detailed in the Guide to the Tutor Message Format. This guide serves as a single resource for all information regarding the Tutor Message Format, including element and attribute descriptions, diagrams, code examples as well as DataShop XML processing expectations. You may also find the sample XML file another useful reference.
In this document the word tool refers to the front-end, user interface. Tool messages should be logged when the student makes an action. Tool messages should also be used for media events. The word tutor refers to the backend system, e.g. the tutor, which logs whether an answer is correct, incorrect or provides hints. Tutor messages are logged when the system responds to the student’s action.
The API conforms to Version 4 of the Tutor Message Format.
The DataShop Logging package is organized in the following manner:
api/ : |
Javadocs for the Logging package. |
dist/ : |
Contains the datashop-logging.jar file. |
example/ : |
Example logging file (Sample.java). |
extlib/ : |
Additional required jars. |
xml/ : |
Contains the DataShop XML schema and the Guide to the Tutor Message Format. |
/ : |
readme.html. |
There are three types of loggers provided by this library, the FileLogger, OLIDiskLogger and OLIDatabaseLogger.
The FileLogger is a simple file logger, which creates a well-formed XML file. This type of file can easily be read into the DataShop.
The Oli DiskLogger creates a file which can easily be imported into an OLI-style log database. It is not, however, easily read with the naked eye.
The OliDatabaseLogger logs directly to an OLI-style log database. Use this logger with caution, as we don’t want to fill up either test or production databases with a lot of test data. It is recommended that you start first with the FileLogger so that the results can easily be checked for correctness.
The general steps are as follows:
e.g. ContextMessage contextMsg = ContextMessage.
createStartProblem (metaElement);
Note: that with this complete rewrite of the logging library, every effort was made to reduce the size of the logging library itself and reduce the number of dependencies. The logging library no longer depends on the log4j or jdom jars, but only depends on the OLI logclient.jar. The reduction in size was done primarily to support Java applets.
The datashop-logging.jar is 52 k.
The logclient.jar is 23 k.
Note: If you need a version that does not depend even on the logclient.jar, please contact us. We can easily do that too.
A subset of classes and methods are outlined below. For detailed information about the classes provided in the datashop-logging.jar, please reference the Javadoc API.
Also see the sample application for more details.
FileLogger fileLogger = FileLogger.create("MyPlainFile.xml");
Note: When logging to files, you may want to produce multiple files, perhaps a file per student.
This message is needed to put the problem in context. Logging this information once instead of with every tool and tutor message saves space.
String timeString = "2006-08-30 11:22:33";
MetaElement metaElement = new MetaElement(userId, sessionId, timeString, timeZone);
ContextMessage contextMsg = ContextMessage.createStartProblem(metaElement);>
This can be done with the generageGUID
method. This will return something like: “JUNK-2c72fcf0:10d8424c05d:-8000”
String sessionId = Message.generateGUID("JUNK");
yyyy-MM-dd HH:mm:ss.SSS
yyyy-MM-dd HH:mm:ss
yyyy-MM-dd HH:mm
MMMMM dd, yyyy hh:mm:ss a
MM/dd/yy HH:mm:ss:SSS
MM/dd/yy HH:mm:ss
ToolMessage toolMsg = ToolMessage.create(contextMsg);
toolMsg.setProblemName(problemName);
toolMsg.setAsAttempt();
toolMsg.setAsHintRequest();
toolMsg.addSai("TextBox1", "EnterText", "box");
fileLogger.log(toolMsg);
TutorMessage tutorMsg = TutorMessage.create(toolMsg);
tutorMsg.setAsCorrectAttemptResponse();
tutorMsg.setAsHintResponse();
tutorMsg.addSai("ButtonOne", "PressButton", "square");
tutorMsg.addSkill(new SkillElement("Dictation", "General", "Basic"));
fileLogger.log(tutorMsg);
To get the version of the jar file, execute a command something like this:
java -classpath "dist/datashop-logging.jar;extlib/log4j-1.2.13.jar" edu.cmu.pslc.datashop.util.VersionInformation
To run the sample application which produces a log file to the local disk, execute something like this:
java -classpath "dist/datashop-logging.jar;extlib/logclient.jar;extlib/commons-lang-2.2.jar" edu.cmu.pslc.logging.Sample
Also see the Sample.java
to see how these classes are used.