Browse Source

Add oslo.config option for split-loggers

For people setting creating Sessions via load_from_conf_options, such as
the OpenStack services, turning on split-loggers needs to be done in a
config file. In order to do that, we need to expose it in the conf
options list.

Don't add it to the argparse options for now - it would just add another
command line option that is less likely to see use.

Change-Id: I106c6acbe306e581d293612630ec810c11d9d61c
tags/3.7.0
Monty Taylor 1 year ago
parent
commit
80323289c7
No account linked to committer's email address

+ 8
- 0
keystoneauth1/loading/session.py View File

@@ -147,6 +147,7 @@ class Session(base.BaseLoader):
147 147
             :insecure: Whether to ignore SSL verification.
148 148
             :timeout: The max time to wait for HTTP connections.
149 149
             :collect-timing: Whether to collect API timing information.
150
+            :split-loggers: Whether to log requests to multiple loggers.
150 151
 
151 152
         :param dict deprecated_opts: Deprecated options that should be included
152 153
              in the definition of new options. This should be a dict from the
@@ -188,6 +189,11 @@ class Session(base.BaseLoader):
188 189
                                 'collect-timing'),
189 190
                             default=False,
190 191
                             help='Collect per-API call timing information.'),
192
+                cfg.BoolOpt('split-loggers',
193
+                            deprecated_opts=deprecated_opts.get(
194
+                                'split-loggers'),
195
+                            default=False,
196
+                            help='Log requests to multiple loggers.')
191 197
                 ]
192 198
 
193 199
     def register_conf_options(self, conf, group, deprecated_opts=None):
@@ -200,6 +206,7 @@ class Session(base.BaseLoader):
200 206
             :insecure: Whether to ignore SSL verification.
201 207
             :timeout: The max time to wait for HTTP connections.
202 208
             :collect-timing: Whether to collect API timing information.
209
+            :split-loggers: Whether to log requests to multiple loggers.
203 210
 
204 211
         :param oslo_config.Cfg conf: config object to register with.
205 212
         :param string group: The ini group to register options in.
@@ -242,6 +249,7 @@ class Session(base.BaseLoader):
242 249
         kwargs.setdefault('key', c.keyfile)
243 250
         kwargs.setdefault('timeout', c.timeout)
244 251
         kwargs.setdefault('collect_timing', c.collect_timing)
252
+        kwargs.setdefault('split_loggers', c.split_loggers)
245 253
 
246 254
         return self.load_from_options(**kwargs)
247 255
 

+ 1
- 0
keystoneauth1/tests/unit/loading/test_session.py View File

@@ -77,6 +77,7 @@ class ConfLoadingTests(utils.TestCase):
77 77
             'insecure',
78 78
             'timeout',
79 79
             'collect-timing',
80
+            'split-loggers',
80 81
         ]
81 82
         depr = dict([(n, [new_deprecated()]) for n in opt_names])
82 83
         opts = loading.get_session_conf_options(deprecated_opts=depr)

+ 4
- 0
releasenotes/notes/oslo-config-split-loggers-6bda266d657fe921.yaml View File

@@ -0,0 +1,4 @@
1
+---
2
+features:
3
+  - |
4
+    Added ``split-loggers`` option to the oslo.config Session options.

Loading…
Cancel
Save