diff --git a/models/db/engine.go b/models/db/engine.go index 660ea1f5e..27e5fb9e1 100755 --- a/models/db/engine.go +++ b/models/db/engine.go @@ -155,8 +155,14 @@ func InitEngine(ctx context.Context) error { Logger: log.GetLogger("xorm"), }) } + + errorLogger := log.GetLogger("xorm") + if setting.IsInTesting { + errorLogger = log.GetLogger(log.DEFAULT) + } + xormEngine.AddHook(&ErrorQueryHook{ - Logger: log.GetLogger("xorm"), + Logger: errorLogger, }) SetDefaultEngine(ctx, xormEngine) diff --git a/modules/testlogger/testlogger.go b/modules/testlogger/testlogger.go index 0229564e0..2861f61ad 100644 --- a/modules/testlogger/testlogger.go +++ b/modules/testlogger/testlogger.go @@ -357,6 +357,9 @@ var ignoredErrorMessage = []string{ // TestRenameInvalidUsername `TrString() [E] Missing translation "form.Name"`, + + // TestDatabaseCollation + `[E] [Error SQL Query] INSERT INTO test_collation_tbl (txt) VALUES ('main') []`, } func (w *testLoggerWriterCloser) recordError(msg string) {