-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Do not set nil value for log_backtrace_at flag #3077
Conversation
dgraph-io#3062 added capabilities to set flag values from config file (we need this for glog). This caused an issue with the log_backtrace_at flag. The flag is defined as `flag.Var(&logging.traceLocation, "log_backtrace_at", "when logging hits line file:N, emit a stack trace")` where tracelocation is ``` // traceLocation represents the setting of the -log_backtrace_at flag. type traceLocation struct { file string line int } ``` If the value isn't specified the nil value for `tracelocation` type is set in the config, which is `tracelocation{"", 0}`. But this value can't be set to the flag because of the check on line https://github.com/golang/glog/blob/master/glog.go#L374 This PR adds skips setting the flag to nil value if it nil in the config. Fixes dgraph-io#3076 Signed-off-by: Ibrahim Jarif <[email protected]>
@danielmai can you please review this PR? |
It looks like this addresses it. Will do some testing. |
I see 5 checks on other PRs but this one has only 2 checks. I don't know why. |
I wish we could have some tests. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 1 files at r1.
Reviewable status: complete! all files reviewed, all discussions resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 1 files at r1.
Reviewable status: complete! all files reviewed, all discussions resolved
dgraph-io#3062 added capabilities to set flag values from config file (we need this for glog). This caused an issue with the log_backtrace_at flag. The flag is defined as `flag.Var(&logging.traceLocation, "log_backtrace_at", "when logging hits line file:N, emit a stack trace")` where tracelocation is ``` // traceLocation represents the setting of the -log_backtrace_at flag. type traceLocation struct { file string line int } ``` If the value isn't specified the nil value for `tracelocation` type is set in the config, which is `tracelocation{"", 0}`. But this value can't be set to the flag because of the check on line https://github.com/golang/glog/blob/master/glog.go#L374 This PR adds skips setting the flag to nil value if it nil in the config. Fixes dgraph-io#3076 Signed-off-by: Ibrahim Jarif <[email protected]>
#3062 added capabilities to set flag values from config file (we need this for glog).
This caused an issue with the log_backtrace_at flag.
The flag is defined as
flag.Var(&logging.traceLocation, "log_backtrace_at", "when logging hits line file:N, emit a stack trace")
where tracelocation isIf the value isn't specified the nil value for tracelocation type is set in the config, which is tracelocation{"", 0}.
But this value can't be set to the flag because of the check on line https://github.com/golang/glog/blob/master/glog.go#L374
This PR adds skips setting the flag to nil value if it nil in the config.
Fixes #3076
Signed-off-by: Ibrahim Jarif [email protected]
This change is