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

Support logging to file #1816

Merged
merged 15 commits into from
Mar 17, 2021
Merged

Support logging to file #1816

merged 15 commits into from
Mar 17, 2021

Conversation

refs
Copy link
Member

@refs refs commented Mar 17, 2021

When running supervised, support for configuring all logs to a single log file:

OCIS_LOG_FILE=/Users/foo/bar/ocis.log MICRO_REGISTRY=etcd bin/ocis server

Supports directing log from single extensions to a log file:

PROXY_LOG_FILE=/Users/foo/bar/proxy.log MICRO_REGISTRY=etcd bin/ocis proxy

TODO

  • add changelog
  • add documentation

Docs

OCIS File Logging

Design Choices:

  • if the file does not exist, the command aborts and exits with status 1.
  • Pretty logs are only available in the console.
  • When running with pretty logs, writing to file is disabled.

Use Cases

  • start default runtime extensions: OCIS_LOG_FILE=/Users/foo/bar/ocis OCIS_LOG_PRETTY=true OCIS_LOG_COLOR=true bin/ocis server
    • every default extension log is written to foo/bar/ocis.log.
  • start an extension using the single binary redirecting log output to a dedicated log file: OCIS_LOG_FILE=/Users/foo/bar/proxy.log OCIS_LOG_PRETTY=true OCIS_LOG_COLOR=true bin/ocis proxy
    • all logs only for the proxy extension are written to foo/bar/proxy.log.
  • start an extension without the single binary: PROXY_LOG_FILE=/Users/foo/bar/proxy.log go run cmd/proxy/main.go server
    • all logs only for the proxy extension are written to foo/bar/proxy.log.
  • start an extension with ocis run proxy
    • not yet supported.

@update-docs
Copy link

update-docs bot commented Mar 17, 2021

Thanks for opening this pull request! The maintainers of this repository would appreciate it if you would create a changelog item based on your changes.

@refs refs self-assigned this Mar 17, 2021
@butonic
Copy link
Member

butonic commented Mar 17, 2021

nice. logging to file and tailing works fine ;-)

@sonarqubecloud
Copy link

@refs
Copy link
Member Author

refs commented Mar 17, 2021

Sonar is going to have a hard time with PR's across our extensions, since there is, by definition, lots of duplicated code. I suggest tweaking the duplication setting on the ownCloud quality gate to a value higher than 50%, at least for extension folders, if it is possible. cc @C0rby

@refs refs marked this pull request as ready for review March 17, 2021 21:50
@refs refs requested a review from LukasHirt as a code owner March 17, 2021 21:50
@refs refs merged commit 4d021ae into master Mar 17, 2021
@refs refs deleted the file-logging-ocis-1666 branch March 17, 2021 21:51
ownclouders pushed a commit that referenced this pull request Mar 17, 2021
Merge: 05f60af 192fa11
Author: Alex Unger <[email protected]>
Date:   Wed Mar 17 22:51:30 2021 +0100

    Merge pull request #1816 from owncloud/file-logging-ocis-1666
@fschade fschade mentioned this pull request Mar 29, 2021
17 tasks
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.

2 participants