Do not set nil value for log_backtrace_at flag#3077
Merged
manishrjain merged 1 commit intodgraph-io:masterfrom Mar 1, 2019
Merged
Do not set nil value for log_backtrace_at flag#3077manishrjain merged 1 commit intodgraph-io:masterfrom
manishrjain merged 1 commit intodgraph-io:masterfrom
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 <jarifibrahim@gmail.com>
Contributor
Author
|
@danielmai can you please review this PR? |
Contributor
|
It looks like this addresses it. Will do some testing. |
Contributor
Author
|
I see 5 checks on other PRs but this one has only 2 checks. I don't know why. |
Contributor
Author
I wish we could have some tests. |
danielmai
approved these changes
Feb 28, 2019
Contributor
danielmai
left a comment
There was a problem hiding this comment.
Reviewed 1 of 1 files at r1.
Reviewable status:complete! all files reviewed, all discussions resolved
manishrjain
approved these changes
Mar 1, 2019
Contributor
manishrjain
left a comment
There was a problem hiding this comment.
Reviewed 1 of 1 files at r1.
Reviewable status:complete! all files reviewed, all discussions resolved
dna2github
pushed a commit
to dna2fork/dgraph
that referenced
this pull request
Jul 19, 2019
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 <jarifibrahim@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
#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 jarifibrahim@gmail.com
This change is