Repository: borgbackup/borg

Issue:
`borg debug` call fails due to missing logger setup
```
[nix-shell:/run/media/ronny/backups/borg_test/borg_recreate_repair_test]$ borg debug
Traceback (most recent call last):
  File "/run/user/1000/tmp.53SX7QRY7s/bin/borg", line 11, in <module>
    load_entry_point('borgbackup', 'console_scripts', 'borg')()
  File "/home/ronny/Projects/borgbackup/borg/src/borg/archiver.py", line 2800, in main
    logger.error(msg)
  File "/home/ronny/Projects/borgbackup/borg/src/borg/logger.py", line 178, in error
    return self.__logger.error(*args, **kw)
  File "/home/ronny/Projects/borgbackup/borg/src/borg/logger.py", line 150, in __logger
    raise Exception("tried to call a logger before setup_logging() was called")
Exception: tried to call a logger before setup_logging() was called

[nix-shell:/run/media/ronny/backups/borg_test/borg_recreate_repair_test]$ borg --version
borg 1.1.0.dev76+ng7e5ed40
```


Discussion:

Resolving patch:
diff --git a/borg/archiver.py b/borg/archiver.py
--- a/borg/archiver.py
+++ b/borg/archiver.py
@@ -992,6 +992,11 @@ def do_help(self, parser, commands, args):
             parser.error('No help available on %s' % (args.topic,))
         return self.exit_code
 
+    def do_subcommand_help(self, parser, args):
+        """display infos about subcommand"""
+        parser.print_help()
+        return EXIT_SUCCESS
+
     def preprocess_args(self, args):
         deprecations = [
             # ('--old', '--new', 'Warning: "--old" has been deprecated. Use "--new" instead.'),
@@ -1148,13 +1153,14 @@ def build_parser(self, args=None, prog=None):
         subparser.add_argument('location', metavar='REPOSITORY', nargs='?', default='',
                                type=location_validator(archive=False))
 
-        subparser = subparsers.add_parser('key',
+        subparser = subparsers.add_parser('key', parents=[common_parser],
                                           description="Manage a keyfile or repokey of a repository",
                                           epilog="",
                                           formatter_class=argparse.RawDescriptionHelpFormatter,
                                           help='manage repository key')
 
         key_parsers = subparser.add_subparsers(title='required arguments', metavar='<command>')
+        subparser.set_defaults(func=functools.partial(self.do_subcommand_help, subparser))
 
         key_export_epilog = textwrap.dedent("""
         If repository encryption is used, the repository is inaccessible
@@ -1681,13 +1687,14 @@ def build_parser(self, args=None, prog=None):
         in case you ever run into some severe malfunction. Use them only if you know
         what you are doing or if a trusted developer tells you what to do.""")
 
-        subparser = subparsers.add_parser('debug',
+        subparser = subparsers.add_parser('debug', parents=[common_parser],
                                           description='debugging command (not intended for normal use)',
                                           epilog=debug_epilog,
                                           formatter_class=argparse.RawDescriptionHelpFormatter,
                                           help='debugging command (not intended for normal use)')
 
         debug_parsers = subparser.add_subparsers(title='required arguments', metavar='<command>')
+        subparser.set_defaults(func=functools.partial(self.do_subcommand_help, subparser))
 
         debug_info_epilog = textwrap.dedent("""
         This command displays some system information that might be useful for bug


Test patch: