Log In    |    Knowledge Base    |    4D Home
Tech Tip: Investigating the Project Mode Conversion Log
Published On: April 23, 2024

When performing a binary mode to project mode conversion, a log is generated whether the conversion was successful or not. The log is generated at the 'Logs' directory of the database with the naming pattern of 'Conversion {ISO Date Time}.json' where the ISO Date Time is the date and time the log was generated in ISO Date Time format of YYYY-MM-DDTHH-mm-ss

The conversion log provides a list of details on any relevant details encountered during the process. These can be simply informative details, warnings on items that may cause some changes but did not prevent the conversion, or errors that were detected that may prevent the conversion from succeeding.

The log can be lengthy and contain a lot of information which can be hard to investigate from a text editor. Instead, a better option can be to parse the log using 4D. The log is in JSON format with each item as an object.
The format of the log is {"messages": [COLLECTION OF MESSAGES] , "success" : [True or False]}
The collection of messages has a message for each detail that is logged and the success attribute is a True if the project mode database was generated or False if not.

In the collection of messages, each message has two common attributes, a "message" attribute and a "severity" attribute. The "message" attribute contains a plain text description of the logged item, such as a Compatibility setting being toggled, a Picture being exported, an incompatible form object setting, or some other detail. The "severity" attribute describes the level of significance of the message. Some additional attributes may be provided based on the message, such as form details if the message relates to a form.

A log can be parsed by using the JSON Parse command:

// $logPath_t contains path to Conversion Log
$logText_t:= Document to text ($logPath)
$logJSON_o:=JSON Parse($logText_t)

The results can then be interacted with using the collection class API functions. For example, the following code will create a collection of distinct "message" attributes and their count:
$messageCount_col:=$logJSON_o.messages.distinct("message";ck count values)

The result can be viewed to see each item and how many occurred:

The results can also be narrowed down to something like only the warnings:
$messageCount_col:=$logJSON_o.messages.query("severity=warning").distinct("message";ck count values)

or all messages of the same message:
$message_t:="Highlight buttons are unsupported and converted as invisible buttons. You may consider using 3D buttons instead."

This will return a collection of objects with the "message" attribute searched for. The additional attributes detail the form and object to allow the issue to be addressed:

While the above provides some general suggestions on how to parse the conversion log, there are various ways to interact and parse the log to better investigate it and address any problems needed.