diff --git a/log/logger_context.go b/log/logger_context.go index 06946f47..c2d94dc6 100644 --- a/log/logger_context.go +++ b/log/logger_context.go @@ -70,8 +70,8 @@ func (l *LoggerAdapter) BeforeSQL(ctx LogContext) {} func (l *LoggerAdapter) AfterSQL(ctx LogContext) { var sessionPart string v := ctx.Ctx.Value(SessionIDKey) - if v != nil { - sessionPart = fmt.Sprintf(" [%s]", v.(string)) + if key, ok := v.(string); ok { + sessionPart = fmt.Sprintf(" [%s]", key) } if ctx.ExecuteTime > 0 { l.logger.Infof("[SQL]%s %s %v - %v", sessionPart, ctx.SQL, ctx.Args, ctx.ExecuteTime) diff --git a/xorm.go b/xorm.go index e9cd7415..2fe32e50 100644 --- a/xorm.go +++ b/xorm.go @@ -51,6 +51,7 @@ func NewEngine(driverName string, dataSourceName string) (*Engine, error) { driverName: driverName, dataSourceName: dataSourceName, db: db, + logSessionID: false, } if dialect.URI().DBType == schemas.SQLITE {