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

Write logs to file #2427

Open
wants to merge 3 commits into
base: master
from

Conversation

Projects
None yet
3 participants
@BasPH

BasPH commented Oct 13, 2017

Was surprised that logs are only written to stdout and there was no option for other destinations. This PR allows for writing logs to file, defined in the config with:

log:
  output:
    file: /path/to/log
@GordonTheTurtle

This comment has been minimized.

Show comment
Hide comment
@GordonTheTurtle

GordonTheTurtle Oct 13, 2017

Please sign your commits following these rules:
https://github.com/moby/moby/blob/master/CONTRIBUTING.md#sign-your-work
The easiest way to do this is to amend the last commit:

$ git clone -b "log-to-file" git@github.com:BasPH/distribution.git somewhere
$ cd somewhere
$ git rebase -i HEAD~842353265024
editor opens
change each 'pick' to 'edit'
save the file and quit
$ git commit --amend -s --no-edit
$ git rebase --continue # and repeat the amend for each commit
$ git push -f

Amending updates the existing PR. You DO NOT need to open a new one.

GordonTheTurtle commented Oct 13, 2017

Please sign your commits following these rules:
https://github.com/moby/moby/blob/master/CONTRIBUTING.md#sign-your-work
The easiest way to do this is to amend the last commit:

$ git clone -b "log-to-file" git@github.com:BasPH/distribution.git somewhere
$ cd somewhere
$ git rebase -i HEAD~842353265024
editor opens
change each 'pick' to 'edit'
save the file and quit
$ git commit --amend -s --no-edit
$ git rebase --continue # and repeat the amend for each commit
$ git push -f

Amending updates the existing PR. You DO NOT need to open a new one.

BasPH added some commits Oct 12, 2017

@BasPH

This comment has been minimized.

Show comment
Hide comment
@BasPH

BasPH Oct 13, 2017

Whoops, didn't know about the signing. Done.

BasPH commented Oct 13, 2017

Whoops, didn't know about the signing. Done.

@codecov

This comment has been minimized.

Show comment
Hide comment
@codecov

codecov bot Oct 13, 2017

Codecov Report

Merging #2427 into master will decrease coverage by 9.6%.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2427      +/-   ##
==========================================
- Coverage   60.32%   50.72%   -9.61%     
==========================================
  Files         126      126              
  Lines       14436    14442       +6     
==========================================
- Hits         8708     7325    -1383     
- Misses       4844     6373    +1529     
+ Partials      884      744     -140
Impacted Files Coverage Δ
configuration/configuration.go 66.42% <ø> (ø) ⬆️
registry/registry.go 2.42% <0%> (-0.07%) ⬇️
registry/storage/driver/gcs/gcs.go 0.32% <0%> (-66.13%) ⬇️
registry/storage/driver/oss/oss.go 0.45% <0%> (-56.5%) ⬇️
registry/storage/driver/s3-aws/s3.go 4.07% <0%> (-55.4%) ⬇️
registry/storage/driver/s3-goamz/s3.go 0.4% <0%> (-52.4%) ⬇️
registry/client/transport/transport.go 68.75% <0%> (-8.75%) ⬇️

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 7484e51...4a1ac84. Read the comment docs.

codecov bot commented Oct 13, 2017

Codecov Report

Merging #2427 into master will decrease coverage by 9.6%.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2427      +/-   ##
==========================================
- Coverage   60.32%   50.72%   -9.61%     
==========================================
  Files         126      126              
  Lines       14436    14442       +6     
==========================================
- Hits         8708     7325    -1383     
- Misses       4844     6373    +1529     
+ Partials      884      744     -140
Impacted Files Coverage Δ
configuration/configuration.go 66.42% <ø> (ø) ⬆️
registry/registry.go 2.42% <0%> (-0.07%) ⬇️
registry/storage/driver/gcs/gcs.go 0.32% <0%> (-66.13%) ⬇️
registry/storage/driver/oss/oss.go 0.45% <0%> (-56.5%) ⬇️
registry/storage/driver/s3-aws/s3.go 4.07% <0%> (-55.4%) ⬇️
registry/storage/driver/s3-goamz/s3.go 0.4% <0%> (-52.4%) ⬇️
registry/client/transport/transport.go 68.75% <0%> (-8.75%) ⬇️

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 7484e51...4a1ac84. Read the comment docs.

@stevvooe

This comment has been minimized.

Show comment
Hide comment
@stevvooe

stevvooe Oct 23, 2017

Contributor

Actually, they go to stderr. ;)

We don't have this option because it forces the system to have rotation and other features. Basically, file-based logging tends to lead to filled disks. If we can avoid adding this, I'd prefer not. Most daemon management (systemd, upstartd, runit, daemontools, etc.) support this model but there may be something still in use that I am unaware of.

Are you not able to run the registry in a context that has a proper stderr logging facility? I'd be open to this if there were some situation that made stderr logging completely untenable. If so, let me know.

Contributor

stevvooe commented Oct 23, 2017

Actually, they go to stderr. ;)

We don't have this option because it forces the system to have rotation and other features. Basically, file-based logging tends to lead to filled disks. If we can avoid adding this, I'd prefer not. Most daemon management (systemd, upstartd, runit, daemontools, etc.) support this model but there may be something still in use that I am unaware of.

Are you not able to run the registry in a context that has a proper stderr logging facility? I'd be open to this if there were some situation that made stderr logging completely untenable. If so, let me know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment