#248 Use stdout instead of stderr for logs

Closed
opened 3 weeks ago by BirkhoffLee · 5 comments

What I’m trying to do and why

Im using cronjobs to run Borgmatic. When a job finishes with any output, cron sends an email to a configured address.

I’d like to only receive logs when there’s an error. So we can output to stderr instead of stdout.

Steps to reproduce (if a bug)

Include (sanitized) borgmatic configuration files if applicable.

Actual behavior (if a bug)

Include (sanitized) --verbosity 2 output if applicable.

Expected behavior (if a bug)

Other notes / implementation ideas

Environment

borgmatic version: [version here]

Use sudo borgmatic --version or sudo pip show borgmatic | grep ^Version

borgmatic installation method: [e.g., Debian package, Docker container, etc.]

Borg version: [version here]

Use sudo borg --version

Python version: [version here]

Use python3 --version

Database version (if applicable): [version here]

Use psql --version or mysql --version on client and server.

operating system and version: [OS here]

#### What I'm trying to do and why Im using cronjobs to run Borgmatic. When a job finishes with any output, cron sends an email to a configured address. I’d like to only receive logs when there’s an error. So we can output to stderr instead of stdout. #### Steps to reproduce (if a bug) Include (sanitized) borgmatic configuration files if applicable. #### Actual behavior (if a bug) Include (sanitized) `--verbosity 2` output if applicable. #### Expected behavior (if a bug) #### Other notes / implementation ideas #### Environment **borgmatic version:** [version here] Use `sudo borgmatic --version` or `sudo pip show borgmatic | grep ^Version` **borgmatic installation method:** [e.g., Debian package, Docker container, etc.] **Borg version:** [version here] Use `sudo borg --version` **Python version:** [version here] Use `python3 --version` **Database version (if applicable):** [version here] Use `psql --version` or `mysql --version` on client and server. **operating system and version:** [OS here]
witten commented 3 weeks ago
Owner

Thanks for filing the ticket. I’m not quite sure I’m understanding the request though. First, have you tried running borgmatic with --verbosity 0, the default? That provides no output unless there is an error. Or are you using a higher verbosity level? Can you say a little more about when you’re hoping to receive logs via cron emails, and what your use case is when you receive them?

Second, what’s the distinction between stdout and stderr that you’re making here? Doesn’t cron send email on any output, stdout or stderr?

Thanks for filing the ticket. I'm not quite sure I'm understanding the request though. First, have you tried running borgmatic with `--verbosity 0`, the default? That provides no output unless there is an error. Or are you using a higher verbosity level? Can you say a little more about when you're hoping to receive logs via cron emails, and what your use case is when you receive them? Second, what's the distinction between stdout and stderr that you're making here? Doesn't cron send email on any output, stdout or stderr?
BirkhoffLee commented 3 weeks ago
Poster

I was in a hurry, sorry.

Seems like the —-verbosity 0 will do the job. I’ll try and reply here.

I was in a hurry, sorry. Seems like the —-verbosity 0 will do the job. I’ll try and reply here.
witten commented 3 weeks ago
Owner

Cool, hopefully that does it! Either way, please let me know.

Cool, hopefully that does it! Either way, please let me know.
witten added the
waiting for response
label 3 weeks ago
BirkhoffLee commented 1 week ago
Poster

Seems like -v -1 does the job correctly. Thanks for the help!

Seems like `-v -1` does the job correctly. Thanks for the help!
witten removed the
waiting for response
label 1 week ago
witten commented 1 week ago
Owner

Glad to hear it!

Glad to hear it!
witten added the
question / support
label 1 week ago
Sign in to join this conversation.
No Milestone
No Assignees
2 Participants
Due Date

No due date set.

Dependencies

This issue currently doesn't have any dependencies.

Loading…
Cancel
Save
There is no content yet.