Logging and Error Handling

Overview

ObjectHandler allows specification of a log file where information and error messages are written. Function ohLogSetFile is used to enable logging to a chosen logfile. Please refer to the functional documentation for specifics about additional ObjectHandler functions in support of logging.

Error Handling on Excel

On Excel, whenever a function from the ObjectHandler Addin (or its clients) encounters an error, the function returns #NUM to the calling cell. In this case a corresponding error message is written to the log file. The error message may also be retrieved by calling function ohRangeRetrieveError.

Logging Levels (Thresholds)

The underlying logging framework (the log4cxx utility) implements a concept of thresholds, allowing greater granularity in determining which messages appear in the logfile. The ObjectHandler logging functions expose this threshold functionality, however it's not really used and the default logging thresholds are adequate. In the current implementation it's never necessary to override the default value for the loglevel parameter of the ohLogSetFile / ohLogWriteMessage function, nor to call the ohLogSetLevel function.