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

Do not log to console when outputting as JSON #1358

Closed
wants to merge 1 commit into from

Conversation

kxait
Copy link

@kxait kxait commented Oct 28, 2023

The default logging behavior and format can cause issues when the output format is JSON, as apparent in this issue in signal-cli-rest-api. This PR changes the logging behavior so that if the output type is JSON, log messages won't be printed to the console (but still can be viewed using the log file)

Result:

$ ./signal-cli version 
WARN  MultiAccountManager - Ignoring +48123456789: User is not registered. (NotRegisteredException)
signal-cli 0.12.4

$ ./signal-cli --log-file log.txt -o json version
{"version":"0.12.4"}

$ cat log.txt
2023-10-28T18:28:05.124+0200 [main] WARN  o.a.s.manager.MultiAccountManager - Ignoring +48123456789: User is not registered. (NotRegisteredException)

@AsamK
Copy link
Owner

AsamK commented Oct 29, 2023

This shouldn't be an issue, logs are printed on stderr and messages are printed on stdout.

@AsamK AsamK closed this Nov 3, 2023
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