Skip to content

debugFlags doesn't seem to work #747

@chirastefan

Description

@chirastefan

I want to see logs for every DB transaction. I added the debugFlags option with all the possible options, and I cannot see any logs in the console, nor the simulator from Console App from macOS.

Build info

  • objectbox: ^4.3.0
  • objectbox_flutter_libs: any
  • Flutter/Dart version: Flutter (Channel stable, 3.32.8, on macOS 15.6 24G84 darwin-arm64, locale en-US)
  • Deployment OS or device: iOS simulator 18.5 iPhone 16

Steps to reproduce

final itemIdToUpdate='someid';
final entityToUpdate=SomeEntity();
    return await storeRepo.store.runInTransactionAsync<Item, SetItemParams>(TxMode.write, (store, params) {
      final builder = store.box<ItemModel>().query()..link(ItemModel.user, UserModel_.id.equals(user.id));
      final query = builder.build();

      try {
        final items = query.find();
        final foundItem = items.where((p) => p.id == itemIdToUpdate).firstOrNull;

        final model = params.itemMapper.toModel(entity: entityToUpdate, user: user);
        final id = store.box<ItemModel>().put(model);
        final savedItem = store.box<ItemModel>().get(id)!;

        return params.itemMapper.toEntity(model: savedItem);
      } finally {
        query.close();
      }
    }, SetItemParams(itemMapper: mapper, userMapper: userRepo.mapper));

Expected behavior

The code above does not update the entry in the DB and does not throw any error.

Actual behavior

I want to check the logs. Admin logs are useless, and also, Admin does not work in parallel with the app; it constantly throws

[ERROR:flutter/runtime/dart_vm_initializer.cc(40)] Unhandled Exception: StorageException: failed to create transaction: Could not begin read transaction (22) (OBX_ERROR code 10199)
#0      ObjectBoxNativeError.throwMapped (package:objectbox/src/native/bindings/helpers.dart:99:11)
#1      throwLatestNativeError (package:objectbox/src/native/bindings/helpers.dart:54:48)
#2      checkObxPtr (package:objectbox/src/native/bindings/helpers.dart:31:5)
#3      new Transaction (package:objectbox/src/native/transaction.dart:33:5)
#4      Store._runInTransaction (package:objectbox/src/native/store.dart:782:32)
#5      Store.runInTransaction (package:objectbox/src/native/store.dart:640:12)
#6      Store.runInTransactionAsync.<anonymous closure> (package:objectbox/src/native/store.dart:663:21)
#7      _RunAsyncIsolateConfig.runCallback (package:objectbox/src/native/store.dart:971:51)
#8      Store._callFunctionWithStoreInIsolate (package:objectbox/src/native/store.dart:675:44)
#9      _delayEntrypointInvocation.<<>

Code

    final store = Store(
      getObjectBoxModel(),
      directory: path.join(docsDir.path, _dbFolder),
      maxDBSizeInKB: 4 * 1024 * 1024, // 4GB
      macosApplicationGroup: 'obx_db.demo',
      debugFlags: DebugFlags.logQueries, // tested all possible values
    );

Logs, stack traces

system.log from the simulator instance

Aug 20 00:50:39 192 syslogd[58289]: --- syslogd restarted ---
Aug 20 00:50:39 192 syslogd[58289]: Configuration Notice:
	ASL Module "com.apple.contacts.ContactsAutocomplete" claims selected messages.
	Those messages may not appear in standard system log files or in the ASL database.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions