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

fix: logger on Windows #1947

Merged
merged 4 commits into from
Jun 23, 2021
Merged

fix: logger on Windows #1947

merged 4 commits into from
Jun 23, 2021

Conversation

bzp2010
Copy link
Contributor

@bzp2010 bzp2010 commented Jun 22, 2021

Please answer these questions before submitting a pull request, or your PR will get closed.

Why submit this pull request?

  • Bugfix
  • New feature provided
  • Improve performance
  • Backport patches

What changes will this PR take into?

The following errors will appear when the current Manager API is running on windows.

panic: couldn't open sink "C:\\apisix-dashboard\\api\\logs\\error.log": no sink found for scheme "c"

uber-go/zap can't directly handle the windows path starting with, for example, C:\. This PR adds a new scheme processor, which supports accessing log files on Windows system by using winfile:///C:\. At the same time, the program will automatically add winfile when generating the absolute path on Windows.

Checklist:

  • Did you explain what problem does this PR solve? Or what new features have been added?
  • Have you added corresponding test cases?
  • Have you modified the corresponding document?
  • Is this PR backward compatible? If it is not backward compatible, please discuss on the mailing list first

@bzp2010 bzp2010 added bug Something isn't working backend labels Jun 22, 2021
@bzp2010 bzp2010 self-assigned this Jun 22, 2021
@netlify
Copy link

netlify bot commented Jun 22, 2021

✔️ Deploy Preview for apisix-dashboard ready!

🔨 Explore the source changes: d947510

🔍 Inspect the deploy log: https://app.netlify.com/sites/apisix-dashboard/deploys/60d19a2748e6f40008049ec4

😎 Browse the preview: https://deploy-preview-1947--apisix-dashboard.netlify.app/

@codecov-commenter
Copy link

codecov-commenter commented Jun 22, 2021

Codecov Report

Merging #1947 (ce45ba9) into master (e3debe5) will decrease coverage by 2.96%.
The diff coverage is n/a.

❗ Current head ce45ba9 differs from pull request most recent head d947510. Consider uploading reports for the commit d947510 to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1947      +/-   ##
==========================================
- Coverage   66.91%   63.95%   -2.97%     
==========================================
  Files         179      122      -57     
  Lines        6537     3154    -3383     
  Branches      753      753              
==========================================
- Hits         4374     2017    -2357     
+ Misses       1897     1137     -760     
+ Partials      266        0     -266     
Flag Coverage Δ
backend-e2e-test ?
backend-e2e-test-ginkgo ?
backend-unit-test ?
frontend-e2e-test 63.95% <ø> (-0.07%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
web/src/helpers.tsx 68.85% <0.00%> (-3.28%) ⬇️
api/cmd/stop.go
api/internal/core/storage/storage_mock.go
api/cmd/version.go
api/internal/route.go
api/internal/core/storage/etcd.go
api/internal/core/store/validate_mock.go
api/internal/handler/upstream/upstream.go
api/internal/filter/authentication.go
api/internal/handler/healthz/healthz.go
... and 45 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 e3debe5...d947510. Read the comment docs.

Copy link
Member

@nic-chen nic-chen left a comment

Choose a reason for hiding this comment

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

Please test manually to confirm that there is no problem, since CI does not support Windows currently.

@bzp2010
Copy link
Contributor Author

bzp2010 commented Jun 22, 2021

@nic-chen

Please test manually to confirm that there is no problem, since CI does not support Windows currently.

I found that when I remove the code in conf.go to get the absolute path of the file, I can directly use the relative path to write the log on windows.

Update1 When I did, I couldn't pass CI's linux test. I will adopt the original plan for the time being. This will produce some redundant code. At the same time, I will refactor the configuration module in another PR (#1946) to solve these problems.

@bzp2010 bzp2010 force-pushed the fix-logger-windows branch from 1c86e75 to d947510 Compare June 22, 2021 08:07
@bzp2010 bzp2010 merged commit 1fa139f into apache:master Jun 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants