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

Use error.Error() string for log attributes #947

Merged
merged 1 commit into from
Sep 5, 2024

Conversation

ejsolberg
Copy link
Contributor

Links

Running against the latest agent version v3.34.0

w/ Logrus LogsInContext configured (doc)

Related to new functionality added in
Capture Log Attributes in the Agent #900
Using Logrus attributes #937

Details

Currently, when errors are logged with the Logs in Context integration, the type is emitted instead of the error string.

log.WithError(fmt.Errorf("this is the error message")).Error("Something went wrong")

Console output:

{"error":"this is the error message","level":"error","msg":"Something went wrong"}

NewRelic Log:

{"error":"*errors.errorString","level":"error","msg":"Something went wrong"}

This change aligns the NewRelic log attribute with the console output

@CLAassistant
Copy link

CLAassistant commented Aug 15, 2024

CLA assistant check
All committers have signed the CLA.

@iamemilio iamemilio self-requested a review August 27, 2024 15:27
@iamemilio iamemilio changed the base branch from master to develop August 27, 2024 16:17
@iamemilio
Copy link
Contributor

Hi, thanks for this contribution! Can you rebase it against develop? That is where we stage all of our commits. Otherwise, it looks good!

@ejsolberg ejsolberg force-pushed the attribute_error_string branch 2 times, most recently from 55df35b to 9507c04 Compare August 27, 2024 17:33
@ejsolberg
Copy link
Contributor Author

Hi @iamemilio, thanks for the initial review! I've rebased to develop

@iamemilio iamemilio merged commit f527e41 into newrelic:develop Sep 5, 2024
54 checks passed
This was referenced Oct 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants