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

logging: unify pkg/log and plugin/log #2245

Merged
merged 1 commit into from
Oct 31, 2018
Merged

logging: unify pkg/log and plugin/log #2245

merged 1 commit into from
Oct 31, 2018

Conversation

miekg
Copy link
Member

@miekg miekg commented Oct 27, 2018

Default to using pkg/log for all logging output and make that always use
UTC.

Signed-off-by: Miek Gieben miek@miek.nl

@corbot
Copy link

corbot bot commented Oct 27, 2018

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 /OWNERS) for a review.

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-io
Copy link

codecov-io commented Oct 27, 2018

Codecov Report

Merging #2245 into master will increase coverage by 0.04%.
The diff coverage is 85.71%.

Impacted file tree graph

@@            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
Impacted Files Coverage Δ
plugin/log/setup.go 86.44% <ø> (+5.48%) ⬆️
coremain/run.go 31.3% <0%> (ø) ⬆️
plugin/log/log.go 76% <100%> (ø) ⬆️
plugin/pkg/replacer/replacer.go 42.85% <100%> (+4.58%) ⬆️
plugin/etcd/handler.go 89.28% <0%> (-3.58%) ⬇️
plugin/route53/route53.go 82.4% <0%> (-2.78%) ⬇️
plugin/etcd/etcd.go 74.07% <0%> (-2.47%) ⬇️
core/dnsserver/listen_go111.go 0% <0%> (ø) ⬆️
plugin/loop/setup.go 46.8% <0%> (+0.97%) ⬆️
plugin/cache/cache.go 78.09% <0%> (+1.09%) ⬆️
... and 3 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update cfbfa5c...d0e3081. Read the comment docs.

Copy link
Contributor

@fturib fturib left a 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.

@@ -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.
Copy link
Contributor

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)
Copy link
Contributor

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

@miekg
Copy link
Member Author

miekg commented Oct 29, 2018 via email

@miekg
Copy link
Member Author

miekg commented Oct 30, 2018

I'll update this to spit the date in w/ a timezone and RFC3339

Copy link
Contributor

@fturib fturib left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@miekg
Copy link
Member Author

miekg commented Oct 30, 2018 via email

@fturib
Copy link
Contributor

fturib commented Oct 30, 2018

I was thinking that if you enable Log plugin, then you already know you will have no perf ...
But maybe I am wrong.

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 ?

Copy link
Contributor

@rdrozhdzh rdrozhdzh left a 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.

plugin/pkg/log/log.go Outdated Show resolved Hide resolved
Copy link
Collaborator

@jameshartig jameshartig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@drazhanski
Copy link
Contributor

@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.

@miekg
Copy link
Member Author

miekg commented Oct 31, 2018 via email

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>
@miekg miekg merged commit 2456416 into master Oct 31, 2018
@corbot corbot bot deleted the logging branch October 31, 2018 21:32
mdgreenfield pushed a commit to DataDog/coredns that referenced this pull request Mar 4, 2019
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>
Jason-ZW pushed a commit to rancher/coredns that referenced this pull request Apr 17, 2019
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>
dna2github pushed a commit to dna2fork/coredns that referenced this pull request Jul 19, 2019
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>
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.

6 participants