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

[Bug] Print to stderr instead of using a logger for warnings/errors #567

Open
dandavison opened this issue May 17, 2024 · 1 comment
Open
Labels
bug Something isn't working

Comments

@dandavison
Copy link
Contributor

In general, CLIs are not expected to produce logging output: they take in stdin and command line args, and output stdout and stderr. Our CLI does have at least one exception: we start a server with start dev. However, warnings and errors from short "transactional" commands should just be printed to stderr as plain natural language, without timestamps or other metadata.

One example of a current violation is

$ temporal operator namespace create default
time=2024-05-17T17:42:01.766 level=WARN msg="Passing the namespace as an argument is now deprecated; please switch to using -n instead"
@dandavison dandavison added the bug Something isn't working label May 17, 2024
@sync-by-unito sync-by-unito bot closed this as completed Jul 12, 2024
@josh-berry josh-berry reopened this Jul 12, 2024
@dandavison
Copy link
Contributor Author

Other examples of incorrect logging behavior include:

Here, an invalid update request was made. The CLI should print the error message without formatting it as a log message.

$ /opt/homebrew/bin/temporal workflow update --workflow-id doesnotexist --name update1
time=2024-08-27T09:47:51.644 level=ERROR msg="unable to update workflow: sql: no rows in result set"

Here, ctrl-c on a CLI should just exit with non-zero shell process exit status. It’s not normal for a CLI to produce an ERROR-level log message on ctrl-c

$ /opt/homebrew/bin/temporal workflow update --workflow-id wid --name update1
^Ctime=2024-08-27T09:44:55.093 level=ERROR msg="program interrupted"

It's just the formatting as a log message that's wrong; the text does go to stderr and the process exit code is 1 as expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants