Closed JaDuyve closed 6 months ago
I created a PR which applies the above-mentioned change. Do you think this change would be suitable for this issue 😃? https://github.com/erikbra/grate/pull/520
Thank you. Bad testing on my part there 😄 unit tests doesn't test everything...
Fixed in #520
Describe the bug Grate still logs everything while running grate internal migrations.
From debugging the code I think the reason it still logs everything when running internal migrations is because the logger is created before setting the new configuration into the
DbMigrator
instance. The methodIsInternalMigration
uses the configuration from inside theDbMigrator
instance as you can see inside code snippet 2.https://github.com/erikbra/grate/blob/13132276d62123b21946b436d81bc63d1b6b7ee5/src/grate.core/Migration/GrateMigrator.cs#L16-L31
https://github.com/erikbra/grate/blob/13132276d62123b21946b436d81bc63d1b6b7ee5/src/grate.core/Migration/GrateMigrator.cs#L282-L283
I tried lowering the line where the logger is created below the line where the new configuration (
value
) is set into the newly createdDbMigrator
instance, and it worked from what I can see. Although still some things are logged because they are logged with a logger provided by dependency injection and not the custom created logger (I'm not sure if this is a bad thing).This is what I get when I apply the above-mentioned change.
To Reproduce Just run grate when the internal migrations haven't been run.
Expected behavior Logs with log level below warning during internal migration should not be visible.
Desktop (please complete the following information):