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

Logs of CLI commands should go to stderr? #969

Closed
lainiwa opened this issue Aug 1, 2024 · 3 comments
Closed

Logs of CLI commands should go to stderr? #969

lainiwa opened this issue Aug 1, 2024 · 3 comments
Assignees
Milestone

Comments

@lainiwa
Copy link

lainiwa commented Aug 1, 2024

Currently clickhouse-backup logs everything to stdout.
This makes it harder to script.

An example:

# Otherwise `clickhouse-backup list` will contaminate stdout
export LOG_LEVEL=error

# ...
# Override S3_PATH: we cannot do that in a http request
LATEST_BACKUP_SHARD_5=$(S3_PATH=clickhouse/shard-5 clickhouse-backup list remote latest)

This works, but it will swallow all the non-error info, that might be valuable otherwise.

@Slach
Copy link
Collaborator

Slach commented Aug 1, 2024

currently not, could you help us with race conditions when switching to zerolog
#670, this log library can write different log level to different steams

@lainiwa
Copy link
Author

lainiwa commented Aug 1, 2024

Unfortunately I don't think I could help as my golang experience is none.

Anyways, maybe #670 is only tangentially related to this issue:
writing different log levels to different streams might be useful for daemon-like services, like clickhouse-backup server or clickhouse-backup watch,
but I think CLI utils should redirect strictly all logs to stderr, as opposed to the actual return value.

@Slach
Copy link
Collaborator

Slach commented Aug 2, 2024

ok. let's change current behavior

@Slach Slach added this to the 2.5.22 milestone Aug 2, 2024
@Slach Slach self-assigned this Aug 2, 2024
@Slach Slach closed this as completed in 1b5b448 Aug 2, 2024
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

No branches or pull requests

2 participants