iTwin / itwinjs-core

Monorepo for iTwin.js Library
https://www.itwinjs.org
MIT License
606 stars 210 forks source link

SQLite warning log spam when creating new Standalone iModels #6066

Open karolis-zukauskas opened 12 months ago

karolis-zukauskas commented 12 months ago

Describe the bug When creating a new standalone iModel with StandaloneDb.createEmpty(...) I get 259 log messages with severity warning and the message "no such table: ...". Everything seems to work after creating the standalone iModel, so I believe the spam of warnings is unnecessary.

To Reproduce Execute: StandaloneDb.createEmpty("D:\\temp.bim", { rootSubject: { name: "test" } });

Expected behavior If everything is fine (I assume it is), don't show ~260 warnings (looks like something is wrong and obfuscates actual warnings/errors).

Screenshots image

Desktop (please complete the applicable information):

nick4598 commented 12 months ago

You can add Logger.setLevel(NativeLoggerCategory.SQLite, LogLevel.None); as a line before StandaloneDb.createEmpty and that should suppress all of these warnings. Would that work for you?

karolis-zukauskas commented 12 months ago

@nick4598, I don't want to supress logging because what if there are actual errors/warnings being logged that I want to take care of? It just feels like the implementation is "cheating" and instead of doing some proper check if tables exist it executes an empty query and catches the error - somewhere in that call stack the log happens. It shouldn't be that way ..

karolis-zukauskas commented 12 months ago

I guess we could disable logging and re-enable it right after the StandaloneDb.createEmpty(...) call, but still feels a bit odd.