Question
How can I log information and events from HexSight?
Answer
There is a way to generate a log file in HexSight, reporting all the events that occur in all the HexSight controls.
To generate a log file, two environment variables are necessary. Environment variables can be added in the Control Panel > System and Security > System > Advanced system settings > Environment Variables > System variables. These variables are the following:
- HEXSIGHT_LOG_LEVEL = TRACE
- HEXSIGHT_LOG_FILE = C:\HexSightLogs\hs.log
Note that the folder C:\HexSightLogs must already exists, or any folder that is specified by the HEXSIGHT_LOG_FILE variable.
The log file generated will look like this:
2017/03/06 12:16:58.785 02080 Event HexSight: Version: 5,0,1,16 (debug) 2017/03/06 12:16:58.785 02080 Event HexSight: FileName: c:\HS.log 2017/03/06 12:16:58.786 02080 Event HexSight: Level: 1 2017/03/06 12:16:58.786 02080 Event HexSight: MaxSize: 209715200 2017/03/06 12:16:58.786 02080 Event HexSight: Module: 2017/03/06 12:16:58.786 02080 Event HexSight: Console: 0 2017/03/06 12:16:58.787 02080 Debug (HSAdFsiGocatorFunctions.cpp, 201) HSAcquisitionDevice: Looking for P:\Gocator\4.5.4.120\GO_SDK\bin\win64\kApi.dll 2017/03/06 12:16:58.815 02080 Debug (HSAdFsiGocatorFunctions.cpp, 206) HSAcquisitionDevice: Module loaded 2017/03/06 12:16:58.815 02080 Debug (HSAdFsiGocatorFunctions.cpp, 201) HSAcquisitionDevice: Looking for P:\Gocator\4.5.4.120\GO_SDK\bin\win64\GoSdk.dll 2017/03/06 12:16:58.836 02080 Debug (HSAdFsiGocatorFunctions.cpp, 206) HSAcquisitionDevice: Module loaded 2017/03/06 12:16:58.927 02080 Debug (HSAdFsiGocatorFunctions.cpp, 149) HSAcquisitionDevice: GoSystem Initialized 2017/03/06 12:17:00.303 02080 Warn (HSAdImniProcess.cpp , 140) HSClassLibrary: HSException 2017/03/06 12:17:00.641 02080 Info (hsdpycontrol.cpp , 9860) HSDisplay: DirectX Enabled 2017/03/06 12:17:00.641 02080 Trace (hsdpycontrol.cpp , 9872) HSDisplay: DirectX Surface creation 2017/03/06 12:17:00.666 02080 Trace (hsdpycontrol.cpp , 9888) HSDisplay: Surface created 2017/03/06 12:17:00.668 02080 Info (hsdpycontrol.cpp , 9860) HSDisplay: DirectX Enabled 2017/03/06 12:17:00.668 02080 Trace (hsdpycontrol.cpp , 9872) HSDisplay: DirectX Surface creation 2017/03/06 12:17:00.668 02080 Trace (hsdpycontrol.cpp , 9888) HSDisplay: Surface created 2017/03/06 12:17:00.758 02080 Debug (HSAdGiProcess.cpp , 171) HSAcquisitionDevice: GigE: Finding PvSystem. 2017/03/06 12:17:02.807 02080 Debug (HSAdGiProcess.cpp , 192) HSAcquisitionDevice: GigE: Interface: 0. 2017/03/06 12:17:02.807 02080 Debug (HSAdGiProcess.cpp , 201) HSAcquisitionDevice: GigE: 0 Devices on Interface: 0. ...
- 1. Event
- 2. Trace
- 3. Debug
- 4. Info
- 5. Warn
- 6. Error
- 7. Fatal
HEXSIGHT_LOG_SIZE is the maximum number of bytes written in the logs. When the initial log file reaches half of this number, the log file is rolled and renamed (name + "_rolled"), and a second file is created. Once the new file also reaches half of this number, the old _rolled file is removed and replaced with the new file, and the cycle restarts. With this method, the logs can never exceed the HEXSIGHT_LOG_SIZE, and it guarantees that at least half of the amount specified is kept in the logs.
The default value for this variable is 200MB, meaning it will create a maximum of 2 files of 100MB each.
- Ex: HEXSIGHT_LOG_SIZE = 200000000
HEXSIGHT_LOG_MODULE
HEXSIGHT_LOG_MODULE allows the user to specify a single module to report. Setting this variable will block any other control to stop reporting. This is useful to keep the log files scoped to a single module, in case of an issue specific to this module. This is the prefix of the description in the log file. The default is set to no module, in order to log information for all modules.
- Ex: To see only reports of events such as HSClassLibrary: HSException, use HEXSIGHT_LOG_MODULE = HSClassLibrary
HEXSIGHT_LOG_CONSOLE
The HEXSIGHT_LOG_CONSOLE allows the user to see the events in an additional console, for quick investigation. The log file is still generated, but the console can show the events at runtime.
- Ex: HEXSIGHT_LOG_CONSOLE = TRUE
Comments
0 comments
Please sign in to leave a comment.