Browse KB Articles
Using Logging in the Spinnaker SDK
KB Number: 11107
Application Note Description
This application note describes the logging features of the Spinnaker SDK and provides examples of how you can use logging to troubleshoot your application.
There are two types of logging in Spinnaker: File logging and API logging. File logging writes to files all the Spinnaker log messages that are generated. API logging allows you to add custom log messages to your application.
File Logging—Logging Levels and Configuration Files
Spinnaker supports five levels of logging:
You can define the logging level that you want to monitor. Levels are inclusive, that is, if you monitor debug level error, you also monitor all logging levels above it.
Spinnaker generates four log files:
Spinnaker log files are stored in:
Log files are configured with property files located in:
If you are using a different Visual Studio, adjust the path accordingly to \vs2015\, or \vs2010\.
By default, the logging level is ERROR, except for the SpinView logging pane which defaults to NOTICE.
To change the logging level, edit the configuration file. For example, to change from ERROR to DEBUG:
API Logging—Add Custom Logging to your Application
Note: When writing your own application that requires log files, ensure that the executable or include path contains the Log4cpp.[Node Level].property file.
You can use the Spinnaker API to add custom logging to your application.
1. Define your customized logging function.
class LoggingEventHandler : public LoggingEvent
2. Register your customized logging function.
3. Set your logging priority level.
There is a source code example in Spinnaker.
Logging.cpp shows how to create a handler to access logging events.
The example creates a user-defined class, LoggingEventHandler, that inherits from the Spinnaker class, LoggingEvent. The child class allows the user to define any properties, parameters, and the event itself while LoggingEvent allows the child class to appropriately interface with the Spinnaker SDK.
Using Logs to Troubleshoot Issues
Example: Camera fails to enumerate in SpinView
In SpinView, the camera is not detected. The SpinView logging pane has no messages about the camera, because it cannot detect it.
1. Configure the GenTL.log to use the debug level of logging.
2. Connect the camera again.
3. View the GenTL.log from C:\ProgramData\Spinnaker\Logs.
Using the debug log, you can see that an incompatible driver is preventing the camera from being detected.