Use stdout instead of stderr for logs #248

Closed
opened 2019-11-19 06:00:10 +00:00 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]
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?
Author

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.
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 2019-11-20 04:18:45 +00:00
Author

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 2019-12-01 01:02:00 +00:00
Owner

Glad to hear it!

Glad to hear it!
witten added the
question / support
label 2019-12-01 01:02:23 +00:00
Sign in to join this conversation.
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: borgmatic-collective/borgmatic#248
No description provided.