-
Notifications
You must be signed in to change notification settings - Fork 424
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
ddtrace/tracer: diagnostic and startup logs should be in JSON format. #2152
Comments
This is an intentional behavior of the tracer. If you can point to the documentation that states they should be completely in JSON format, we can clarify there. I've shifted this from a bug to a proposal. |
Hey @knusbaum , |
See also #2077. If we support |
As mentioned in the docs, these prefixes are meant to simplify the search within your logs. They are also unified across the different Datadog tracers.
While we don't expect to change the current default format of these logs in dd-trace-go, we're not against giving users the ability to reformat the logs and use any other formats they want (including JSON). We're happy to review and guide any contributions to allow doing this. For better tracking and prioritization, you can also reach out to the support team and submit a feature request. Thanks. |
Hello, I'm interested in this and have opened a support case. We're facing the issue that Traefik Ingress Controller uses this library and while we have Traefik configured for JSON logging, this library is still logging to plaintext, which is breaking log parsing by Fluentd for our Traefik logs. |
As a workaround for this issue, you can use the package main
import (
"go.uber.org/zap"
"gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer"
)
type ddLogger struct {
logger *zap.Logger
}
func (d *ddLogger) Log(msg string) {
d.logger.Info(msg)
}
func main() {
// initialize your JSON logger - in this example I'm using go.uber.org/zap
logger, err := zap.NewProduction()
if err != nil {
panic(err)
}
defer logger.Sync()
tracer.Start(tracer.WithLogger(&ddLogger{logger: logger}))
defer tracer.Stop()
// ...
} We are aware the existing |
Version of dd-trace-go
latestDescribe what happened:
general issueDescribe what you expected: The whole log should be printed in json format
Steps to reproduce the issue:
Additional environment details (Version of Go, Operating System, etc.):
The text was updated successfully, but these errors were encountered: