Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

logger format error, logger can't parse "%" #5261

Open
notnotype opened this issue Apr 15, 2022 · 2 comments
Open

logger format error, logger can't parse "%" #5261

notnotype opened this issue Apr 15, 2022 · 2 comments
Assignees
Labels
type:question general questions

Comments

@notnotype
Copy link

logger format error, logger can't parse "%"

When i run this code,

tx = tx.Where("username like ?", "%" dtoUser.Username "%")

I got this log

[0.613ms] [rows:1] SELECT * FROM `users` WHERE username like '%!a(MISSING)dmin%!'(MISSING)

The document you expected this should be explained

Expected answer

I want the log like this

SELECT * FROM `users` WHERE username like �min% 

The logger make %a and %' as format character.

@notnotype notnotype added the type:question general questions label Apr 15, 2022
@a631807682
Copy link
Member

a631807682 commented Apr 16, 2022

func TestGORM(t *testing.T) {
	user := User{Name: "jinzhu"}

	DB.Create(&user)

	var users []User
	DB.Where("name LIKE ?", "%" user.Name "%").Find(&users)
}

It's work in last version, maybe you used format like fmt.Printf

@sergi-unimedia
Copy link

We had the same problem! Query works correctly but it prints the !(MISSING) on the logs and it creates confusion while debugging the code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:question general questions
Projects
None yet
Development

No branches or pull requests

4 participants