|
10 | 10 | import warnings # noqa
|
11 | 11 |
|
12 | 12 | from ddtrace import config # noqa
|
| 13 | +from ddtrace._logger import _configure_log_injection |
13 | 14 | from ddtrace.debugging._config import di_config # noqa
|
14 | 15 | from ddtrace.debugging._config import ed_config # noqa
|
15 | 16 | from ddtrace.internal.compat import PY2 # noqa
|
|
19 | 20 | from ddtrace.internal.runtime.runtime_metrics import RuntimeWorker # noqa
|
20 | 21 | from ddtrace.internal.utils.formats import asbool # noqa
|
21 | 22 | from ddtrace.internal.utils.formats import parse_tags_str # noqa
|
22 |
| -from ddtrace.tracer import DD_LOG_FORMAT # noqa |
23 |
| -from ddtrace.vendor.debtcollector import deprecate # noqa |
24 | 23 |
|
25 | 24 |
|
| 25 | +# Debug mode from the tracer will do the same here, so only need to do this otherwise. |
26 | 26 | if config.logs_injection:
|
27 |
| - # immediately patch logging if trace id injected |
28 |
| - from ddtrace import patch |
29 |
| - |
30 |
| - patch(logging=True) |
31 |
| - |
32 |
| - |
33 |
| -# DEV: Once basicConfig is called here, future calls to it cannot be used to |
34 |
| -# change the formatter since it applies the formatter to the root handler only |
35 |
| -# upon initializing it the first time. |
36 |
| -# See https://github.com/python/cpython/blob/112e4afd582515fcdcc0cde5012a4866e5cfda12/Lib/logging/__init__.py#L1550 |
37 |
| -# Debug mode from the tracer will do a basicConfig so only need to do this otherwise |
38 |
| -if not config._debug_mode and config._call_basic_config: |
39 |
| - deprecate( |
40 |
| - "ddtrace.tracer.logging.basicConfig", |
41 |
| - message="`logging.basicConfig()` should be called in a user's application.", |
42 |
| - removal_version="2.0.0", |
43 |
| - ) |
44 |
| - if config.logs_injection: |
45 |
| - logging.basicConfig(format=DD_LOG_FORMAT) |
46 |
| - else: |
47 |
| - logging.basicConfig() |
| 27 | + _configure_log_injection() |
| 28 | + |
48 | 29 |
|
49 | 30 | log = get_logger(__name__)
|
50 | 31 |
|
51 | 32 |
|
52 |
| -if os.environ.get("DD_GEVENT_PATCH_ALL") is not None: |
53 |
| - deprecate( |
54 |
| - "The environment variable DD_GEVENT_PATCH_ALL is deprecated and will be removed in a future version. ", |
55 |
| - postfix="There is no special configuration necessary to make ddtrace work with gevent if using ddtrace-run. " |
56 |
| - "If not using ddtrace-run, import ddtrace.auto before calling gevent.monkey.patch_all().", |
57 |
| - removal_version="2.0.0", |
58 |
| - ) |
59 | 33 | if "gevent" in sys.modules or "gevent.monkey" in sys.modules:
|
60 | 34 | import gevent.monkey # noqa
|
61 | 35 |
|
|
0 commit comments