This guide explains how to configure or disable SDK logging in pyorbbecsdk.
| Value | Level | Description |
|---|---|---|
| 0 | DEBUG | Detailed debug information |
| 1 | INFO | General information (default) |
| 2 | WARN | Warning messages |
| 3 | ERROR | Error messages |
| 4 | FATAL | Fatal errors only |
| 5 | NONE | Disables logging |
Use the Context class to configure logging programmatically:
from pyorbbecsdk import Context, OBLogLevel
# Set console logger level
Context.set_logger_to_console(OBLogLevel.INFO)
# Set file logger with custom path
Context.set_logger_to_file(OBLogLevel.DEBUG, "/path/to/logs")
# Disable console logging
Context.set_logger_to_console(OBLogLevel.NONE)You can also configure logging by editing the OrbbecSDKConfig.xml file:
For pip-installed packages:
pip show pyorbbecsdk2
# Output: Location: /path/to/site-packages
# Full path: /path/to/site-packages/OrbbecSDKConfig.xmlOpen the XML file and find the <Log> section:
<Log>
<FileLogLevel>5</FileLogLevel> <!-- Change to 5 to disable file logging -->
<ConsoleLogLevel>3</ConsoleLogLevel> <!-- 0=DEBUG, 1=INFO, 2=WARN, 3=ERROR, 4=FATAL, 5=NONE -->
</Log><Log>
<FileLogLevel>5</FileLogLevel> <!-- 5 = NONE, disables file logging -->
<ConsoleLogLevel>5</ConsoleLogLevel> <!-- 5 = NONE, disables console logging -->
</Log>See 10_logger.py for a complete working example.
Log files not being created?
- Ensure the log directory exists and has write permissions
- Check that
FileLogLevelis not set to 5 (NONE)
Too much log output?
- Increase the log level (e.g., from DEBUG to INFO or WARN)
- Set console logging to NONE if you only need file logs