dca_interface  6.3.4
Tracing & Logging

Introduction

The SCA supports a comprehensive tracing functionality based on class level. Several classes support tracing by using the setLogLevel() function to change the default tracing.

Log levels

The following log levels are currently supported:
  • LOG_Critical (0)
  • LOG_Error (1)
  • LOG_Warning (2)
  • LOG_Notice (3) default
  • LOG_Info (4)
  • LOG_Extensive (5)
  • LOG_Debug (6)
Per default all classes use log level LOG_Notice, which automatically includes critical messages, errors, warnings and important information.
Setting the log level to a level higher than LOG_Notice is not recommended for common functionality.
Higher log levels should be used only for debugging and tracing, as the resulting log file will become large and the performance may be significantly reduced.
Try to isolate the class of interest and start with setting only the log level for this class e.g.:
// not interested in classification
myUrlClassification = UrlClassification::create( myDca, myLicense );
// interested in myConnection log messages...
LogLevel oldLevel = myConnection.setLogLevel( LOG_Extensive );
// now the connection is using the extensive log level, but URL Classifier and
// classification are still using the default log level (LOG_Notice).
myUrlDbClassifier = myUrlClassification.createDbClassifier( myConnection );
... // do something with your classifier
... // after done reset the log level to the previous value
myConnection.setLogLevel( oldLevel );
Note: Setting the log level at runtime for classes is not a persistent change.
To permanently change the log level of a module (not at class level, but on the SCA lower module layer) you can change init-file keys. To see a complete list of those files refer to Additional settings.

Log files

When you initialize a DcaInstance, you can specify the log directory as one of the initialization structure parameters (dca::InitData::logDir).
When starting your application, a log file (dca_info.log) will be created in that directory. If the file already exists, the new log entries will simply be appended to the file.
The log file size is monitored, and whenever it exceeds a given maximum size it will be backed up to the file dca_info.log.bak, and a new dca_info.log file will be created. If the dca_info.log.bak already exists it will be simply overwritten.
The maximum size of the log file is 250 MB. This can be modified by changing the init-file key [manager_log_max_size] to a custom value (given in MB).
For performance reasons the log file size will only be monitored every 500 log file entries, so the actual file size may slightly exceed the value maximum size specified.
LogLevel setLogLevel(LogLevel newLevel)
Sets the logging level for the given class instance. The old value will be returned.
@ LOG_Extensive
Use extensive logging, this may greatly increase the size of the log file.
Definition: base_classes.h:219
LogLevel
This enum is used in all setLogLevel() functions to change the verbosity level of the classes.
Definition: base_classes.h:212
UrlDbClassifier createDbClassifier(const DbConnection &aDbConnection, const UrlDbClassifierOptions &options=UrlDbClassifierOptions()) const
Create a URL database classifier. The classifier is created by using the provided database connection...