[Borgbackup] sending --list output to stdout instead of stderr

Sitaram Chamarty sitaramc at gmail.com
Tue Mar 15 22:09:50 EDT 2016


On 16/03/16 07:02, Antoine Beaupré wrote:
> On 2016-03-15 21:17:22, Sitaram Chamarty wrote:
>> On 16/03/16 05:53, Thomas Waldmann wrote:
>>>> When using "borg create -v -s -p --list ...", would it be possible to
>>>> send the output of the "--list" to stdout instead of stderr?
>>>>
>>>> I would like to do some post-processing on the list output, while also
>>>> seeing progress (-v, -s, -p) on the screen as it runs.
>>>
>>> We usually use stderr for log output because stdout might be used for connecting borg to other tools via a pipe (and it will transport file data then), like:
>>>
>>> borg extract --stdout ... | dd of=/dev/sdx
>>>
>>> stats output is also logged as I expect many people wanting to have that in their backup logs. So it's currently not possible to write this to different files / channels.
>>
>> Problem solved.  Using the logging conf fixed things for me.  Now I get
>> the "-p" I want to see on screen while still getting the list of files
>> to process later.  I don't see the summary stats on screen anymore but I
>> can do a "tail -15" or so of the logfile if I need that.
> 
> Can you show us what configuration you used? I'd be great to have
> samples for that in the documentation...

Sure, but it's way too simple, though far too verbose for my taste.
Everything is copied from the link in the docs, with no real
understanding (on my part).

    [loggers]
    keys=root

    [handlers]
    keys=hand01

    [formatters]
    keys=form01

    [logger_root]
    level=NOTSET
    handlers=hand01

    [logger_out]
    level=INFO
    handlers=hand02

    [handler_hand01]
    class=FileHandler
    level=DEBUG
    formatter=form01
    args=('borg.log', 'w')

    [formatter_form01]
    format=F1 %(asctime)s %(levelname)s %(message)s
    datefmt=
    class=logging.Formatter


More information about the Borgbackup mailing list