| title | Dev Tools and Debugging - ObjectBox C++ | ||||||
|---|---|---|---|---|---|---|---|
| description | ObjectBox has tools that help during development. Learn more about looking at data inside the database and how to enable debug logs for additional information. | ||||||
| keywords |
|
import Tabs from "@theme/Tabs" import TabItem from "@theme/TabItem"
import { TechnicalArticleSchema } from '@site/src/components/Schema';
ObjectBox has tools that help during development. Learn more about looking at data inside the database and how to enable debug logs for additional information.
ObjectBox Admin is a web-app that can be used to view inside the ObjectBox database. Since it is available as a Docker container with a developer-friendly front-end script you can use it right from a developer console to get insights into your database.
Example: Using just "docker" to run ObjectBox Admin on a database on path ./myapp :
$ docker run --rm -it --volume ./myapp:/db -u $(id -u) -p 8081:8081 objectboxio/admin:latest
Starting server on http://0.0.0.0:8081
001-10:37:02.7767 [INFO ] [SvHttp] Running in single-store mode, store path: /db
001-10:37:02.7767 [INFO ] [SvHttp] Listening on http://0.0.0.0:8081
001-10:37:02.7767 [INFO ] [SvHttp] User management: enabled
001-10:37:02.7771 [INFO ] [SvHttp] HttpServer listening on all interfaces, port 8081
Opening the URL http://localhost:8081 with your browser will open the ObjectBox Admin UI:
:::info See ObjectBox Admin Documentation for further details and to download developer-friendly front-end launcher shell script. :::
ObjectBox includes a logging facility for tracing, amongst others, transaction operations.
The following C++ code below gives an example how to enable logging for transactions at the info level.
obx::Options options(create_obx_model());
options.addDebugFlags(
OBXDebugFlags_LOG_TRANSACTIONS_READ
| OBXDebugFlags_LOG_TRANSACTIONS_WRITE
);
obx::Store store(options);A sample output of the debug log is given below:
$ ./build/myapp
[..]
001-10:23:41.6403 [INFO ] TX #4 (read)
001-10:23:41.6403 [INFO ] TX #4 to be destroyed on owner thread (last committed: TX #2)...
001-10:23:41.6403 [INFO ] TX #4 destroyed
001-10:23:41.6403 [INFO ] TX #5 (write)
001-10:23:41.6403 [INFO ] TX #5 committing...
001-10:23:41.6546 [INFO ] TX #5 to be destroyed on owner thread (last committed: TX #5)...
001-10:23:41.6546 [INFO ] TX #5 destroyed
[..]:::info See C API Documentation of OBXDebugFlag for a list of available debug flags. :::
:::info
ObjectBox also offers a DebugLog which gives insights at a very detail level. This is typically not used by an application end-user but might be helpful when things go wrong or when developing improvements, enhancements and features.
This feature is not available in the public release but on request.
:::
