Repository: borgbackup/borg

Issue:
add repo name to borg create output
Hi,

I'm using borg to backup my systems via batch script to more than one repository and I'm missing the repo name in the output to be able to identify what repo returns an error. It should be possible to add the repo name passed as parameter to the output of the create statement.

Regards
Joachim



Discussion:
Did you try something like this in your script?
```
echo Using repo $BORG_REPO 1>&2
```

(assuming you set BORG_REPO first, which you likely want to do anyway)
Hello Thomas,

thank you for the fast reply.

Your suggestion was my workaround, but why do it in a script... So please treat it as a feature request.

Regards Joachim
OK, let's discuss this:

shall we add something like --show-repo to make borg print the repo url at the start of backup log output?
It's up to you but why adding another cmdline switch ? borg create reports so many things, why not adding the repo name too ?

Regards Joachim
for future diagnostic i add repo name to log using `echo` so +1 for adding to standard output
When pushing logs to a central server it get quite confusing. So having the repo name is a good idea. 

I too prefer having it as a default without additional/needed cli switches.

BTW: @ThomasWaldmann do you have a vision how borgs OOTB experience should be. Is it more ready to run, or more a toolkit to make your own backup script? I prefer the former, as backups should always as easy as possible.
@lightonflux the idea is that borg can do everything that is useful and in its scope of tasks and can be easily implemented for the supported platforms. otoh, we try to avoid "in-tool scripting" because you'll usually need a script that calls borg anyway, so we do not / should not implement stuff that can be just called in such a script before/after borg runs.
First timer here. Has this been worked on? If not I would like to pick this up
Sure, feel free.

Maybe first have some thoughts about what makes sense / is most useful and how it should be done.

Then do a PR against master branch to discuss the code.
Another first timer. Since this is still open, I'd like to work on this. 

After a quick check, I think it'd make sense to have a stderr logging output where the repository is being created in remote.py and repository.py files.

If someone can corroborate that it is an appropriate approach then I can do a PR against the master branch to discuss further. Thank you!
hi @patelsv! can you tell why you want to do it server-side? the client has full information about the repo, so it might be easier to do there. also, we are talking about 1 line of log output.
As this issue is still open, I would like to attempt to fix it, by adding to the output after the creation of the repo. If this issue is still available, please let me know where to start.
`borg create` invokes `do_create` in `src/borg/archiver.py`. you can follow the code flow from there.

@patelsv still working on it?

@JoshuaRM if you don't mind doing double work in case patelsv comes with a PR soon, feel free to just work on it.
@ThomasWaldmann Thank you, I have began working on it, but I am unsure of how I can test this locally with my changes. I have downloaded the borg repo, but am unsure how to run it from my files. Thanks
The docs have a `development` section, did you read it?
I have, however I am still very unsure of how to build/compile to a point where I could be calling my own version of the create function.  
`pip install -e .` from your workdir will "install" the files in your workdir into your active virtual env.
see the install docs about that kind of stuff (from source section).
@JoshuaRM Are you working on it? If not I'd like to take my chance.

Resolving patch:
diff --git a/src/borg/archiver.py b/src/borg/archiver.py
--- a/src/borg/archiver.py
+++ b/src/borg/archiver.py
@@ -541,6 +541,7 @@ def create_inner(archive, cache):
         dry_run = args.dry_run
         t0 = datetime.utcnow()
         t0_monotonic = time.monotonic()
+        logger.info('Creating archive at "%s"' % args.location.orig)
         if not dry_run:
             with Cache(repository, key, manifest, do_files=args.cache_files, progress=args.progress,
                        lock_wait=self.lock_wait, permit_adhoc_cache=args.no_cache_sync,


Test patch: