Logging Settings

From v2.0.0.

The optional logging section of the settings file sets the log directory, the size, number and age of the log files, and the log level of the console and of each logger. A key that is absent keeps the LumiScan VGR default, so "logging": {"level": "DEBUG"} changes only the level. The schema of the section is logging.schema.json.

"logging": {
    "logDir": "",
    "level": "INFO",
    "flushLevel": "INFO",
    "duplicateFilterSeconds": 600,
    "console": { "enabled": true, "stream": "STDOUT" },
    "file": { "enabled": true, "dailyDirectories": true, "maxFileSizeMb": 5, "maxFiles": -1, "retentionDays": 30 },
    "loggers": {
        "ProcessResult": { "level": "DEBUG", "file": { "maxFiles": 5, "retentionDays": 15 } }
    }
}
Key Meaning

logDir

The top-level folder of all log files. Empty: <HDVAppData>\LumiScan VGR\logs (see Generated Data and Files).

level, flushLevel

TRACE, DEBUG, INFO, WARN, ERROR, CRITICAL or OFF. Messages of the flush level or above are written to the file at once.

duplicateFilterSeconds

Identical messages in a row are dropped for this many seconds; 0 switches the filter off.

console

enabled, and stream (STDOUT or STDERR).

file.dailyDirectories

true: a new subfolder every day, <logDir>\<YYYY-MM-DD>\<logger>.log. false: one rotating file per logger, <logDir>\<logger>.log.

file.maxFileSizeMb, file.maxFiles

The size at which a file is rotated, and the number of files kept per logger (per day with dailyDirectories); -1 for any number.

file.retentionDays

Logs older than this many days are deleted. 0 keeps everything.

loggers

Settings of single loggers by name: LumiScanVGR (main log), ProcedureCallLogger, ProcessResult and Deprecated.

Every folder named YYYY-MM-DD in logDir counts as a log day and is deleted when it is older than retentionDays. Do not use the folder for other data.

Overriding the Settings File

The same keys can be set by the user in %LOCALAPPDATA%\HD Vision Systems GmbH\LumiScan VGR\logging.json and, for one run, by environment variables. These override the settings file, in this order (highest first):

  1. HDV_LOG_LEVEL and HDV_LOG_FLUSH_LEVEL: the level and the flush level of all loggers.

  2. HDV_LOG_LEVELS (for example ProcessResult=trace,Deprecated=warn) and <LOGGER>_LOG_LEVEL: single loggers. HDV_LOG_DIR sets the folder.

  3. The user file logging.json, or the file named by HDV_LOG_CONFIG.

  4. The logging section of the settings file, then the LumiScan VGR defaults.

The settings are read when LumiScan VGR starts; a change takes effect after a restart. The first lines of a start, before the settings file is read, are written with the defaults.

The loggers of LumiScan VGR are also used by the camera library and the camera plugins, so their messages follow these settings and are in the same log files. Only the LumiScanAPI log, which the LumiScan API keeps for itself in <HDVAppData>\LumiScanAPI\logs, ignores them.