-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
logging: unify pkg/log and plugin/log #2245
Conversation
Thank you for your contribution. I've just checked the OWNERS files to find a suitable reviewer. This search was successful and I've asked fastest963 (via If you have questions or suggestions for this bot, please file an issue against the miekg/dreck repository. The bot understands the commands that are listed here. |
Codecov Report
@@ Coverage Diff @@
## master #2245 +/- ##
==========================================
+ Coverage 56.3% 56.35% +0.04%
==========================================
Files 203 203
Lines 10137 10138 +1
==========================================
+ Hits 5708 5713 +5
+ Misses 3996 3995 -1
+ Partials 433 430 -3
Continue to review full report at Codecov.
|
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.
See my comments about UTC information proposition.
- glitch in one comment.
plugin/log/README.md
Outdated
@@ -7,7 +7,7 @@ | |||
## Description | |||
|
|||
By just using *log* you dump all queries (and parts for the reply) on standard output. Options exist | |||
to tweak the output a little. | |||
to tweak the output a little. The timezone is used is always UTC. |
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.
typo. "The timezone is always UTC"
coremain/run.go
Outdated
@@ -62,7 +62,7 @@ func Run() { | |||
} | |||
|
|||
log.SetOutput(os.Stdout) | |||
log.SetFlags(log.LstdFlags) | |||
log.SetFlags(log.Ldate | log.Ltime | log.LUTC) |
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.
Changing to UTC will surprise everyone, and the date does not say the TZ.
So maybe, while waiting we implement a complete date with TZ in our pkg/log, we can output an info here:
clog.Info("log output - all dates are UTC")
Result is:
API server listening at: 127.0.0.1:55958
2018/10/29 14:51:55 [INFO] log output - all dates are UTC
.:1053
.:1054
2018/10/29 14:51:55 [INFO] CoreDNS-1.2.5
2018/10/29 14:51:55 [INFO] darwin/amd64, go1.10.2,
CoreDNS-1.2.5
darwin/amd64, go1.10.2,
2018/10/29 14:51:55 [INFO] plugin/reload: Running configuration MD5 = 67fbea4124263c10c9c1aa0fb55a538f
[ Quoting <notifications@github.com> in "Re: [coredns/coredns] logging: unif..." ]
+to tweak the output a little. The timezone is used is always UTC.
typo. "The timezone is always UTC"
done.
> @@ -62,7 +62,7 @@ func Run() {
}
log.SetOutput(os.Stdout)
- log.SetFlags(log.LstdFlags)
+ log.SetFlags(log.Ldate | log.Ltime | log.LUTC)
Changing to UTC will surprise everyone, and the date does not say the TZ.
it does not say the timezone because it's UTC, but I agree the std log package
is pretty brain dead in this regard. Logging in local time with a time zone is
even crazier.
~~~
2018/10/29 14:51:55 [INFO] log output - all dates are UTC
~~~
this doesn't add much to saying it in the README (i.e. both will not be read)
/Miek
…--
Miek Gieben
|
I'll update this to spit the date in w/ a timezone and RFC3339 |
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.
LGTM
[ Quoting <notifications@github.com> in "Re: [coredns/coredns] logging: unif..." ]
fturib approved this pull request.
LGTM
thanks we have to decide how backwards incompatible this is; can we just push it
in the next or will this lead to any degraded experience.
|
I was thinking that if you enable Log plugin, then you already know you will have no perf ... I know Log is not enable on the default Corefile for Kubernetes @rdrozhdzh, @drazhanski, @huynhmb359 - will you be impacted if the log is less performant ? |
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.
LGTM
I don't think we'll get any significant performance penalty with this implementation. Earlier, golang log library did time formatting for us, now we do similar formatting ourselves.
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.
LGTM
|
I'll make those changes and then merge.
…On Wed, 31 Oct 2018, 17:27 Dzmitry Razhanski ***@***.*** wrote:
@drazhanski <https://github.com/drazhanski> - will you be impacted if the
log is less performant ?
I don't expect performance problems with this implementation. And usually
we log only error/denial classes of responses, so it can't be so critical.
—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
<#2245 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAVkWxXi2jlUgqx1Bd9qKd7PCxXt_QG7ks5uqd17gaJpZM4X9dsE>
.
|
Default to using pkg/log for all logging and use a fixed time prefix which is RFC3339Millli (doesn't exist in time, so we just extended RFC3339), i.e. Nano might be pushing it. Logs go from: 2018/10/30 19:14:55 [INFO] CoreDNS-1.2.5 2018/10/30 19:14:55 [INFO] linux/amd64, go1.11, to: 2018-10-30T19:10:07.547Z [INFO] CoreDNS-1.2.5 2018-10-30T19:10:07.547Z [INFO] linux/amd64, go1.11, Which includes the timezone - which oddly the std log package doesn't natively do. Signed-off-by: Miek Gieben <miek@miek.nl>
Default to using pkg/log for all logging and use a fixed time prefix which is RFC3339Millli (doesn't exist in time, so we just extended RFC3339), i.e. Nano might be pushing it. Logs go from: 2018/10/30 19:14:55 [INFO] CoreDNS-1.2.5 2018/10/30 19:14:55 [INFO] linux/amd64, go1.11, to: 2018-10-30T19:10:07.547Z [INFO] CoreDNS-1.2.5 2018-10-30T19:10:07.547Z [INFO] linux/amd64, go1.11, Which includes the timezone - which oddly the std log package doesn't natively do. Signed-off-by: Miek Gieben <miek@miek.nl>
Default to using pkg/log for all logging and use a fixed time prefix which is RFC3339Millli (doesn't exist in time, so we just extended RFC3339), i.e. Nano might be pushing it. Logs go from: 2018/10/30 19:14:55 [INFO] CoreDNS-1.2.5 2018/10/30 19:14:55 [INFO] linux/amd64, go1.11, to: 2018-10-30T19:10:07.547Z [INFO] CoreDNS-1.2.5 2018-10-30T19:10:07.547Z [INFO] linux/amd64, go1.11, Which includes the timezone - which oddly the std log package doesn't natively do. Signed-off-by: Miek Gieben <miek@miek.nl>
Default to using pkg/log for all logging and use a fixed time prefix which is RFC3339Millli (doesn't exist in time, so we just extended RFC3339), i.e. Nano might be pushing it. Logs go from: 2018/10/30 19:14:55 [INFO] CoreDNS-1.2.5 2018/10/30 19:14:55 [INFO] linux/amd64, go1.11, to: 2018-10-30T19:10:07.547Z [INFO] CoreDNS-1.2.5 2018-10-30T19:10:07.547Z [INFO] linux/amd64, go1.11, Which includes the timezone - which oddly the std log package doesn't natively do. Signed-off-by: Miek Gieben <miek@miek.nl>
Default to using pkg/log for all logging output and make that always use
UTC.
Signed-off-by: Miek Gieben miek@miek.nl