Logging

Introduction

Logging can be enabled in Qualcomm® Neural Processing SDK during the execution of a network. It is highly recommended to enable logging once at the beginning of the program to capture logs from all processes. Enabling logging may have a performance impact. The following sections demonstrate the logging support in Qualcomm® Neural Processing SDK:

  1. C Logging

    1. C Log Levels

    2. C Logging APIs

  2. Java Logging

    1. Java Log Levels

    2. Java Logging APIs

C Logging

The section demonstrates the available Qualcomm® Neural Processing SDK log levels and logging APIs for C. The following header needs to be included to use the logging functionality.

#include "SNPE/SNPEUtil.h"

For a complete example, please refer to the sample application file located at $SNPE_ROOT/examples/SNPE/NativeCpp/SampleCode_CAPI/ITensor/main.cpp .

C Log Levels

The following are the different log levels supported by Qualcomm® Neural Processing SDK logging APIs in the increasing order of importance.

Level

C Log Level

VERBOSE

SNPE_LOG_LEVEL_VERBOSE

INFO

SNPE_LOG_LEVEL_INFO

WARN

SNPE_LOG_LEVEL_WARN

ERROR

SNPE_LOG_LEVEL_ERROR

FATAL

SNPE_LOG_LEVEL_FATAL

When a specific log level is set, logs with that importance level and higher importance levels will be logged.

C Logging APIs

Qualcomm® Neural Processing SDK provides different variants of logging initialization for Android platforms and non-Android platforms. Please see Snpe_Util_InitializeLogging() for more information.

On Android platforms, the Qualcomm® Neural Processing SDK logs are printed to android logcat. Qualcomm® Neural Processing SDK logging can be initialized with a specific log level by,

Snpe_Util_InitializeLogging(Snpe_LogLevel_t level);

On non-Android platforms, the Qualcomm® Neural Processing SDK logs are printed to console output and into log files created in the specified log path. Qualcomm® Neural Processing SDK logging can be initialized with a specific log level and a log path by,

Snpe_Util_InitializeLoggingPath(Snpe_LogLevel_t level, const char* logPath);

The Qualcomm® Neural Processing SDK logging level can be changed during execution to a specific log level by,

Snpe_Util_SetLogLevel(Snpe_LogLevel_t level);

The Qualcomm® Neural Processing SDK logging can be terminated by,

Snpe_Util_TerminateLogging();

Java Logging

The section demonstrates the available Qualcomm® Neural Processing SDK log levels and logging APIs for Java. The following packages needs to be imported to use the logging functionality.

import com.qualcomm.qti.snpe.SNPE;
import com.qualcomm.qti.snpe.NeuralNetwork;

For a complete example, please refer to the sample android application files located at $SNPE_ROOT/examples/SNPE/android/image-classifiers/app/src/.

Java Log Levels

The following are the different log levels supported by Qualcomm® Neural Processing SDK logging APIs in the increasing order of importance.

Level

Java Log Level

VERBOSE

NeuralNetwork.LogLevel.LOG_VERBOSE

INFO

NeuralNetwork.LogLevel.LOG_INFO

WARN

NeuralNetwork.LogLevel.LOG_WARN

ERROR

NeuralNetwork.LogLevel.LOG_ERROR

FATAL

NeuralNetwork.LogLevel.LOG_FATAL

When a specific log level is set, logs with that importance level and higher importance levels will be logged.

Java Logging APIs

On Android platforms, the Qualcomm® Neural Processing SDK logs are printed to android logcat. Qualcomm® Neural Processing SDK logging can be initialized with a specific log level by,

SNPE.logger.initializeLogging(android.app.Application application, NeuralNetwork.LogLevel logLevel);

The Qualcomm® Neural Processing SDK logging level can be changed during execution to a specific log level by,

SNPE.logger.setLogLevel(NeuralNetwork.LogLevel logLevel);

The Qualcomm® Neural Processing SDK logging can be terminated by,

SNPE.logger.terminateLogging();