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

Error in zerolog-writer.go:45 when message has comma in a message body #583

Closed
polanskya opened this issue Sep 22, 2022 · 6 comments
Closed
Labels

Comments

@polanskya
Copy link

Example:
l.Debug().Msgf(fmt.Sprintf("Renew licenseID: %s**,** licenseType: %s ", licenseID, licenseType))
OR
l.Debug().Msg(" Renew licenseID: %s licenseType: %s ", licenseID, licenseType))

When message has a comma in a message string there is parsing exception
valStart := getValueIndex(log, keyEnd)
Get Value index is -1

/usr/local/Cellar/go@1.17/1.17.13/libexec/src/runtime/panic.go:90 (0x1032314)
goPanicIndex: panic(boundsError{x: int64(x), signed: true, y: y, code: boundsIndex})
/Users/XXX/dev/projects/go/pkg/mod/github.com/newrelic/go-agent/v3/integrations/logcontext-v2/zerolog!writer@v1.0.1/zerolog-writer.go:82 (0x150793a)
getValueIndex: if p[i] == ':' {
/Users/XXX/dev/projects/go/pkg/mod/github.com/newrelic/go-agent/v3/integrations/logcontext-v2/zerolog!writer@v1.0.1/zerolog-writer.go:60 (0x1507789)
parseJSONLogData: valStart := getValueIndex(log, keyEnd)
/Users/XXX/dev/projects/go/pkg/mod/github.com/newrelic/go-agent/v3/integrations/logcontext-v2/zerolog!writer@v1.0.1/zerolog-writer.go:45 (0x1507552)

Without commas , message prints correctly.

{"level":"debug","time":"2022-09-22T11:47:04.184074-04:00","caller":"license.go:55","message":"Renew 2.0"}

@polanskya polanskya added the bug label Sep 22, 2022
@polanskya
Copy link
Author

l.Debug().Msgf(fmt.Sprintf("Renew licenseID: %s, licenseType: %s ", licenseID, licenseType))

@iamemilio
Copy link
Contributor

iamemilio commented Sep 22, 2022

thanks for reporting! I'll have a fix for this soon

@polanskya polanskya changed the title Error in zerolog-writer.go:45 when message has comma in a message mody Error in zerolog-writer.go:45 when message has comma in a message body Sep 22, 2022
@iamemilio
Copy link
Contributor

@polanskya give this a try and let me know if you hit any other snags: #584

@iamemilio
Copy link
Contributor

hey @polanskya would you be willing to work with us on some brainstorming and troubleshooting? We are trying to get a customers perspective on this tooling

@polanskya
Copy link
Author

Sure.. please reach out to me at alex.m.polansky@gmail.com.. tnx

@iamemilio
Copy link
Contributor

Please update your agent and zerologWriter library to the latest versions and let me know if you have any more trouble. The solution for this this is now merged so we are closing.

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

No branches or pull requests

2 participants