Tinderbox Forum

Logging tool (LogRec) suitable for tracing Action Code


This posting updates my earlier Logging for Fun and Profit posting with a revised and enhanced “LogRec” function along with associated stamps and prototypes. I have made extensive use of the LogRec function in tracing Action Code that I’ve been working on, and it has proven to be an effective debugging tool. The current version improves on the original, and sets the stage for further enhancements and additional features.

The latest zip archive is provided here:
Toolbox v1h.zip (1.9 MB) Version 1h 25-June-2022
…includes the logging tool along with some other tools and a demo application that can be used to explore use of the LogRec function in tracing code execution. Of course, logging is a technique that can be applied to a variety of problems beyond debugging code.

Provided below is an overview of the contents included in this version of the “Toolbox” document:

Toolbox Overview

It is intended that this document become a repository for tools that can be used to develop, debug, and support applications built using Tinderbox. In pursuit of this objective, it will be important to explore and evaluate methods for integrating tools from various contributors, and facilitating incorporation of these tools into any Tinderbox user’s documents.

As a near term objective, it is hoped that a constructive dialogue will arise from the community as to what sorts of tools are needed, and how best to share these tools.

To get this initiative underway, an initial tool for recording log book entries is offered in this Tinderbox document. The next note, titled simply “Logging tools,” provides a comprehensive overview of the included LogRec() function, and related elements. Feel free to incorporate this logging tool into your Tinderbox documents, and to adapt it as you see fit. I ask only for feedback and suggestions for useful improvements, as well as ideas for other useful tools.

A separate note is provided in the “Main Document” Container titled, “How to add logging tools to another Document” that explains the extra steps necessary after copying the contents of this file into another Tinderbox Document. However, this technical note is somewhat out of date, and I hope to replace these procedures with a more automated method for adding a “package” to an existing or new document.

There are also two other tech notes provided that offer some examples of working with date and time handling in Tinderbox and suggestions for what to do “When code doesn’t work as expected.” The latter is still very rough, but it would be great to get suggestions for what to include. I intend to update both of these tech notes, and may offer them as new postings to the Forum.

The current version of this Toolbox also includes some additional tools:

  • User Attributes document capture: The “Attributes:Capture User Attributes” Stamp will create a report in the currently selected Note of all User-defined Attributes. There is also a sample report in “Document Commons/Document Attributes” that incorporates recommended tab settings to improve readability of the generated report.
  • “Safe Path” tools: There are two functions provided that deal with potential problems with path confusion when forward or backward slashes are included in Note $Names. In addition, there are three Stamps that apply these functions. These tools use a new User Attribute, “SafePath,” to capture the safe (i.e., escaped) path string for a Note. It is possible to update “SafePath” globally for every Note/Container in the current Tinderbox document.
  • Demo Application: A simplistic application for handling re-stocking of a retail store is included to provide illustrations for using the LogRec function to trace execution of Action Code. This application is implemented as a series of “Play” Stamps plus a “Product” prototype and a sample set of products that might be found in a grocery store. The sample products are located under the top-level “Examples” Container.
  • Document Commons: This Toolbox version also introduces a new approach for having a common repository within a Tinderbox Document where global variables and data structures can be maintained. This is an initial step toward what is planned to be a more comprehensive package management capability. By having the “Document Commons” Container be the last top-level Note in the current document, it can be easily referenced without even knowing the name of this Container. There are two functions provided for building an index Dictionary and retrieving the ID of the last top-level Note in outline order.

Feedback and suggestions for improving these tools would be much appreciated.

Chuck Wade


+1 508 277 6439


An intermittent problem was discovered where the current time and date stamps might print as “never.” This is apparently due to a timing problem with obtaining the current time with seconds. Consequently, the original posting has been updated to include version “1g” of the Tinderbox document. This newer version implements an acceptable workaround. However, if you use timestamps in your log records, you may occasionally see the seconds field with 00 seconds, when it should be some other value. This will hopefully be resolved in some future version of Tinderbox, though it is likely that this is not a Tinderbox problem per se.

Version 1g also includes some minor edits to correct some typos and refine the “Play” demo application.

I think date(today).format(....) would be faster than spawning a shell.

But then how could we get seconds in the time stamp when we want to measure time intervals to seconds resolution, instead of being constrained to minutes resolution?

Ah-- are we still dropping seconds from “today”?

FWIW, today and now don’t appear to honour use seconds although the Date format supports granularity to the second.

Yes, it appears that we are. I checked this pretty carefully over the weekend using 9.2.2 (b560). I agree with @mwra that the only apparent limitation in working with seconds resolution is in getting the current time via Tinderbox using either today or now with the date or time operators.

I’ve got this fixed.


@eastgate—I have confirmed that date(today) and date(now) provide the current time with seconds in the latest beta version. I will update the LogRec function and related tools to comment out the current workaround using the runCommand invocation of the shell “date” command. I’ll also run some tests to see if this provides any noticeable improvement in processor overhead.

Thanks for this quick fix…

This being the main forum I would the changes to date functionality above are being tested Backstage so are not (yet!) in the current public release v9.2.1 (at time of writing).