objectbox / objectbox-go

Embedded Go Database, the fast alternative to SQLite, gorm, etc.
https://objectbox.io
Apache License 2.0
1.07k stars 46 forks source link

How do I disable DEBUG messages. #13

Closed OGKevin closed 4 years ago

OGKevin commented 4 years ago

Everytime i open a connection, a bunch of debug messages spits out wich is nice for dev env, but for prod i rather not have them.

e.g.

001-18:57:34.0229 [DEBUG] Current directory when opening store: <dir>
001-18:57:34.0230 [DEBUG] ObjectBox 2.4.0-2019-06-26 (64 bit mode)
001-18:57:34.0230 [DEBUG] Opening DB "/tmp/obj" (max 1048576 KB, mode 755)...
001-18:57:34.0310 [DEBUG] Opened database /tmp/obj
001-18:57:34.0322 [DEBUG] Synching schema with 1 existing and 1 new entities
001-18:57:34.0323 [DEBUG] TX #1 committed
001-18:57:34.0323 [DEBUG] Closing database
001-18:57:34.0324 [DEBUG] Current directory when opening store: <dir>

001-18:57:34.0324 [DEBUG] Opening DB "/tmp/obj" (max 1048576 KB, mode 755)...
001-18:57:34.0334 [DEBUG] Opened database /tmp/obj
001-18:57:34.0335 [DEBUG] Read 1 entity type(s)
001-18:57:34.0335 [DEBUG] Store set up in 11 ms

How can i disable this ?

The corresponding go code:

objectBox, err := objectbox.NewBuilder().
        Directory(dir).
        Model(SomeModel.ObjectBoxModel()).
        Build()

Thanks in advance.

OGKevin commented 4 years ago

Interestingly, in the docker build these debug messages are notthere. So im kind of confused how these work. Is there any documentation on this?

vaind commented 4 years ago

I assume you're on ObjectBox Go 1.0. How did you install the ObjectBox c library? Did you use the install.sh script or a download.sh from the c-lib repo?

To get rid of the DEBUG messages, you can try reinstalling the library on your dev machine using the quick-installation or the "C binary library" installation script from the docs - https://golang.objectbox.io/install

e.g.

mkdir objectboxlib && cd objectboxlib
bash <(curl -s https://raw.githubusercontent.com/objectbox/objectbox-c/master/download.sh) 0.6.0
greenrobot commented 4 years ago

@OGKevin on which OS are you seeing the DEBUG messages?

OGKevin commented 4 years ago

go version go1.12.7 darwin/amd64 10.14.5 I installled it by running bash <(curl -s https://raw.githubusercontent.com/objectbox/objectbox-go/master/install.sh)

In the build pipeline, i install it by running

  - wget https://raw.githubusercontent.com/objectbox/objectbox-c/master/download.sh
  - chmod 777 ./download.sh
  - ./download.sh --install

which does not have the debug messages 🤔

vaind commented 4 years ago

Thanks for the reply, it seems the c-api had DEBUG logs enabled for mac. It will be changed in the next objectbox-c release. I'll close the issue afterwards.

vaind commented 4 years ago

Resolved by the latest release v1.1.0