We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Unified sentry-sdk integration does not have support to add stack trace in python logger using 'stack': True in extra dict.
Migration from raven to unified sentry sdk, affected extended functionalities to python logging provided by raven. _extra_from_record - excludes keywords 'stack' and 'data'. Is there a known workaround?

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `sentry_sdk/integrations/logging.py`
Content:
```
1 from __future__ import absolute_import
2 
3 import logging
4 import datetime
5 
6 from sentry_sdk.hub import Hub
7 from sentry_sdk.utils import (
8     to_string,
9     event_from_exception,
10     current_stacktrace,
11     capture_internal_exceptions,
12 )
13 from sentry_sdk.integrations import Integration
14 
15 if False:
16     from logging import LogRecord
17     from typing import Any
18     from typing import Dict
19     from typing import Optional
20 
21 DEFAULT_LEVEL = logging.INFO
22 DEFAULT_EVENT_LEVEL = logging.ERROR
23 
24 _IGNORED_LOGGERS = set(["sentry_sdk.errors"])
25 
26 
27 def ignore_logger(name):
28     # type: (str) -> None
29     """This disables the breadcrumb integration for a logger of a specific
30     name.  This primary use is for some integrations to disable breadcrumbs
31     of this integration.
32     """
33     _IGNORED_LOGGERS.add(name)
34 
35 
36 class LoggingIntegration(Integration):
37     identifier = "logging"
38 
39     def __init__(self, level=DEFAULT_LEVEL, event_level=DEFAULT_EVENT_LEVEL):
40         # type: (int, int) -> None
41         self._handler = None
42         self._breadcrumb_handler = None
43 
44         if level is not None:
45             self._breadcrumb_handler = BreadcrumbHandler(level=level)
46 
47         if event_level is not None:
48             self._handler = EventHandler(level=event_level)
49 
50     def _handle_record(self, record):
51         # type: (LogRecord) -> None
52         if self._handler is not None and record.levelno >= self._handler.level:
53             self._handler.handle(record)
54 
55         if (
56             self._breadcrumb_handler is not None
57             and record.levelno >= self._breadcrumb_handler.level
58         ):
59             self._breadcrumb_handler.handle(record)
60 
61     @staticmethod
62     def setup_once():
63         # type: () -> None
64         old_callhandlers = logging.Logger.callHandlers  # type: ignore
65 
66         def sentry_patched_callhandlers(self, record):
67             # type: (Any, LogRecord) -> Any
68             try:
69                 return old_callhandlers(self, record)
70             finally:
71                 # This check is done twice, once also here before we even get
72                 # the integration.  Otherwise we have a high chance of getting
73                 # into a recursion error when the integration is resolved
74                 # (this also is slower).
75                 if record.name not in _IGNORED_LOGGERS:
76                     integration = Hub.current.get_integration(LoggingIntegration)
77                     if integration is not None:
78                         integration._handle_record(record)
79 
80         logging.Logger.callHandlers = sentry_patched_callhandlers  # type: ignore
81 
82 
83 def _can_record(record):
84     # type: (LogRecord) -> bool
85     return record.name not in _IGNORED_LOGGERS
86 
87 
88 def _breadcrumb_from_record(record):
89     # type: (LogRecord) -> Dict[str, Any]
90     return {
91         "ty": "log",
92         "level": _logging_to_event_level(record.levelname),
93         "category": record.name,
94         "message": record.message,
95         "timestamp": datetime.datetime.fromtimestamp(record.created),
96         "data": _extra_from_record(record),
97     }
98 
99 
100 def _logging_to_event_level(levelname):
101     # type: (str) -> str
102     return {"critical": "fatal"}.get(levelname.lower(), levelname.lower())
103 
104 
105 COMMON_RECORD_ATTRS = frozenset(
106     (
107         "args",
108         "created",
109         "data",
110         "exc_info",
111         "exc_text",
112         "filename",
113         "funcName",
114         "levelname",
115         "levelno",
116         "linenno",
117         "lineno",
118         "message",
119         "module",
120         "msecs",
121         "msg",
122         "name",
123         "pathname",
124         "process",
125         "processName",
126         "relativeCreated",
127         "stack",
128         "tags",
129         "thread",
130         "threadName",
131     )
132 )
133 
134 
135 def _extra_from_record(record):
136     # type: (LogRecord) -> Dict[str, None]
137     return {
138         k: v
139         for k, v in vars(record).items()
140         if k not in COMMON_RECORD_ATTRS and not k.startswith("_")
141     }
142 
143 
144 class EventHandler(logging.Handler, object):
145     def emit(self, record):
146         # type: (LogRecord) -> Any
147         with capture_internal_exceptions():
148             self.format(record)
149             return self._emit(record)
150 
151     def _emit(self, record):
152         # type: (LogRecord) -> None
153         if not _can_record(record):
154             return
155 
156         hub = Hub.current
157         if hub.client is None:
158             return
159 
160         hint = None  # type: Optional[Dict[str, Any]]
161         client_options = hub.client.options
162 
163         # exc_info might be None or (None, None, None)
164         if record.exc_info is not None and record.exc_info[0] is not None:
165             event, hint = event_from_exception(
166                 record.exc_info,
167                 client_options=client_options,
168                 mechanism={"type": "logging", "handled": True},
169             )
170         elif record.exc_info and record.exc_info[0] is None:
171             event = {}
172             hint = None
173             with capture_internal_exceptions():
174                 event["threads"] = [
175                     {
176                         "stacktrace": current_stacktrace(client_options["with_locals"]),
177                         "crashed": False,
178                         "current": True,
179                     }
180                 ]
181         else:
182             event = {}
183 
184         event["level"] = _logging_to_event_level(record.levelname)
185         event["logger"] = record.name
186         event["logentry"] = {"message": to_string(record.msg), "params": record.args}
187         event["extra"] = _extra_from_record(record)
188 
189         hub.capture_event(event, hint=hint)
190 
191 
192 # Legacy name
193 SentryHandler = EventHandler
194 
195 
196 class BreadcrumbHandler(logging.Handler, object):
197     def emit(self, record):
198         # type: (LogRecord) -> Any
199         with capture_internal_exceptions():
200             self.format(record)
201             return self._emit(record)
202 
203     def _emit(self, record):
204         # type: (LogRecord) -> None
205         if not _can_record(record):
206             return
207 
208         Hub.current.add_breadcrumb(
209             _breadcrumb_from_record(record), hint={"log_record": record}
210         )
211
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/sentry_sdk/integrations/logging.py b/sentry_sdk/integrations/logging.py
--- a/sentry_sdk/integrations/logging.py
+++ b/sentry_sdk/integrations/logging.py
@@ -106,7 +106,6 @@
     (
         "args",
         "created",
-        "data",
         "exc_info",
         "exc_text",
         "filename",

{"golden_diff": "diff --git a/sentry_sdk/integrations/logging.py b/sentry_sdk/integrations/logging.py\n--- a/sentry_sdk/integrations/logging.py\n+++ b/sentry_sdk/integrations/logging.py\n@@ -106,7 +106,6 @@\n     (\n         \"args\",\n         \"created\",\n-        \"data\",\n         \"exc_info\",\n         \"exc_text\",\n         \"filename\",\n", "issue": "Unified sentry-sdk integration does not have support to add stack trace in python logger using 'stack': True in extra dict.\nMigration from raven to unified sentry sdk, affected extended functionalities to python logging provided by raven. _extra_from_record - excludes keywords 'stack' and 'data'. Is there a known workaround?\n", "before_files": [{"content": "from __future__ import absolute_import\n\nimport logging\nimport datetime\n\nfrom sentry_sdk.hub import Hub\nfrom sentry_sdk.utils import (\n    to_string,\n    event_from_exception,\n    current_stacktrace,\n    capture_internal_exceptions,\n)\nfrom sentry_sdk.integrations import Integration\n\nif False:\n    from logging import LogRecord\n    from typing import Any\n    from typing import Dict\n    from typing import Optional\n\nDEFAULT_LEVEL = logging.INFO\nDEFAULT_EVENT_LEVEL = logging.ERROR\n\n_IGNORED_LOGGERS = set([\"sentry_sdk.errors\"])\n\n\ndef ignore_logger(name):\n    # type: (str) -> None\n    \"\"\"This disables the breadcrumb integration for a logger of a specific\n    name.  This primary use is for some integrations to disable breadcrumbs\n    of this integration.\n    \"\"\"\n    _IGNORED_LOGGERS.add(name)\n\n\nclass LoggingIntegration(Integration):\n    identifier = \"logging\"\n\n    def __init__(self, level=DEFAULT_LEVEL, event_level=DEFAULT_EVENT_LEVEL):\n        # type: (int, int) -> None\n        self._handler = None\n        self._breadcrumb_handler = None\n\n        if level is not None:\n            self._breadcrumb_handler = BreadcrumbHandler(level=level)\n\n        if event_level is not None:\n            self._handler = EventHandler(level=event_level)\n\n    def _handle_record(self, record):\n        # type: (LogRecord) -> None\n        if self._handler is not None and record.levelno >= self._handler.level:\n            self._handler.handle(record)\n\n        if (\n            self._breadcrumb_handler is not None\n            and record.levelno >= self._breadcrumb_handler.level\n        ):\n            self._breadcrumb_handler.handle(record)\n\n    @staticmethod\n    def setup_once():\n        # type: () -> None\n        old_callhandlers = logging.Logger.callHandlers  # type: ignore\n\n        def sentry_patched_callhandlers(self, record):\n            # type: (Any, LogRecord) -> Any\n            try:\n                return old_callhandlers(self, record)\n            finally:\n                # This check is done twice, once also here before we even get\n                # the integration.  Otherwise we have a high chance of getting\n                # into a recursion error when the integration is resolved\n                # (this also is slower).\n                if record.name not in _IGNORED_LOGGERS:\n                    integration = Hub.current.get_integration(LoggingIntegration)\n                    if integration is not None:\n                        integration._handle_record(record)\n\n        logging.Logger.callHandlers = sentry_patched_callhandlers  # type: ignore\n\n\ndef _can_record(record):\n    # type: (LogRecord) -> bool\n    return record.name not in _IGNORED_LOGGERS\n\n\ndef _breadcrumb_from_record(record):\n    # type: (LogRecord) -> Dict[str, Any]\n    return {\n        \"ty\": \"log\",\n        \"level\": _logging_to_event_level(record.levelname),\n        \"category\": record.name,\n        \"message\": record.message,\n        \"timestamp\": datetime.datetime.fromtimestamp(record.created),\n        \"data\": _extra_from_record(record),\n    }\n\n\ndef _logging_to_event_level(levelname):\n    # type: (str) -> str\n    return {\"critical\": \"fatal\"}.get(levelname.lower(), levelname.lower())\n\n\nCOMMON_RECORD_ATTRS = frozenset(\n    (\n        \"args\",\n        \"created\",\n        \"data\",\n        \"exc_info\",\n        \"exc_text\",\n        \"filename\",\n        \"funcName\",\n        \"levelname\",\n        \"levelno\",\n        \"linenno\",\n        \"lineno\",\n        \"message\",\n        \"module\",\n        \"msecs\",\n        \"msg\",\n        \"name\",\n        \"pathname\",\n        \"process\",\n        \"processName\",\n        \"relativeCreated\",\n        \"stack\",\n        \"tags\",\n        \"thread\",\n        \"threadName\",\n    )\n)\n\n\ndef _extra_from_record(record):\n    # type: (LogRecord) -> Dict[str, None]\n    return {\n        k: v\n        for k, v in vars(record).items()\n        if k not in COMMON_RECORD_ATTRS and not k.startswith(\"_\")\n    }\n\n\nclass EventHandler(logging.Handler, object):\n    def emit(self, record):\n        # type: (LogRecord) -> Any\n        with capture_internal_exceptions():\n            self.format(record)\n            return self._emit(record)\n\n    def _emit(self, record):\n        # type: (LogRecord) -> None\n        if not _can_record(record):\n            return\n\n        hub = Hub.current\n        if hub.client is None:\n            return\n\n        hint = None  # type: Optional[Dict[str, Any]]\n        client_options = hub.client.options\n\n        # exc_info might be None or (None, None, None)\n        if record.exc_info is not None and record.exc_info[0] is not None:\n            event, hint = event_from_exception(\n                record.exc_info,\n                client_options=client_options,\n                mechanism={\"type\": \"logging\", \"handled\": True},\n            )\n        elif record.exc_info and record.exc_info[0] is None:\n            event = {}\n            hint = None\n            with capture_internal_exceptions():\n                event[\"threads\"] = [\n                    {\n                        \"stacktrace\": current_stacktrace(client_options[\"with_locals\"]),\n                        \"crashed\": False,\n                        \"current\": True,\n                    }\n                ]\n        else:\n            event = {}\n\n        event[\"level\"] = _logging_to_event_level(record.levelname)\n        event[\"logger\"] = record.name\n        event[\"logentry\"] = {\"message\": to_string(record.msg), \"params\": record.args}\n        event[\"extra\"] = _extra_from_record(record)\n\n        hub.capture_event(event, hint=hint)\n\n\n# Legacy name\nSentryHandler = EventHandler\n\n\nclass BreadcrumbHandler(logging.Handler, object):\n    def emit(self, record):\n        # type: (LogRecord) -> Any\n        with capture_internal_exceptions():\n            self.format(record)\n            return self._emit(record)\n\n    def _emit(self, record):\n        # type: (LogRecord) -> None\n        if not _can_record(record):\n            return\n\n        Hub.current.add_breadcrumb(\n            _breadcrumb_from_record(record), hint={\"log_record\": record}\n        )\n", "path": "sentry_sdk/integrations/logging.py"}], "after_files": [{"content": "from __future__ import absolute_import\n\nimport logging\nimport datetime\n\nfrom sentry_sdk.hub import Hub\nfrom sentry_sdk.utils import (\n    to_string,\n    event_from_exception,\n    current_stacktrace,\n    capture_internal_exceptions,\n)\nfrom sentry_sdk.integrations import Integration\n\nif False:\n    from logging import LogRecord\n    from typing import Any\n    from typing import Dict\n    from typing import Optional\n\nDEFAULT_LEVEL = logging.INFO\nDEFAULT_EVENT_LEVEL = logging.ERROR\n\n_IGNORED_LOGGERS = set([\"sentry_sdk.errors\"])\n\n\ndef ignore_logger(name):\n    # type: (str) -> None\n    \"\"\"This disables the breadcrumb integration for a logger of a specific\n    name.  This primary use is for some integrations to disable breadcrumbs\n    of this integration.\n    \"\"\"\n    _IGNORED_LOGGERS.add(name)\n\n\nclass LoggingIntegration(Integration):\n    identifier = \"logging\"\n\n    def __init__(self, level=DEFAULT_LEVEL, event_level=DEFAULT_EVENT_LEVEL):\n        # type: (int, int) -> None\n        self._handler = None\n        self._breadcrumb_handler = None\n\n        if level is not None:\n            self._breadcrumb_handler = BreadcrumbHandler(level=level)\n\n        if event_level is not None:\n            self._handler = EventHandler(level=event_level)\n\n    def _handle_record(self, record):\n        # type: (LogRecord) -> None\n        if self._handler is not None and record.levelno >= self._handler.level:\n            self._handler.handle(record)\n\n        if (\n            self._breadcrumb_handler is not None\n            and record.levelno >= self._breadcrumb_handler.level\n        ):\n            self._breadcrumb_handler.handle(record)\n\n    @staticmethod\n    def setup_once():\n        # type: () -> None\n        old_callhandlers = logging.Logger.callHandlers  # type: ignore\n\n        def sentry_patched_callhandlers(self, record):\n            # type: (Any, LogRecord) -> Any\n            try:\n                return old_callhandlers(self, record)\n            finally:\n                # This check is done twice, once also here before we even get\n                # the integration.  Otherwise we have a high chance of getting\n                # into a recursion error when the integration is resolved\n                # (this also is slower).\n                if record.name not in _IGNORED_LOGGERS:\n                    integration = Hub.current.get_integration(LoggingIntegration)\n                    if integration is not None:\n                        integration._handle_record(record)\n\n        logging.Logger.callHandlers = sentry_patched_callhandlers  # type: ignore\n\n\ndef _can_record(record):\n    # type: (LogRecord) -> bool\n    return record.name not in _IGNORED_LOGGERS\n\n\ndef _breadcrumb_from_record(record):\n    # type: (LogRecord) -> Dict[str, Any]\n    return {\n        \"ty\": \"log\",\n        \"level\": _logging_to_event_level(record.levelname),\n        \"category\": record.name,\n        \"message\": record.message,\n        \"timestamp\": datetime.datetime.fromtimestamp(record.created),\n        \"data\": _extra_from_record(record),\n    }\n\n\ndef _logging_to_event_level(levelname):\n    # type: (str) -> str\n    return {\"critical\": \"fatal\"}.get(levelname.lower(), levelname.lower())\n\n\nCOMMON_RECORD_ATTRS = frozenset(\n    (\n        \"args\",\n        \"created\",\n        \"exc_info\",\n        \"exc_text\",\n        \"filename\",\n        \"funcName\",\n        \"levelname\",\n        \"levelno\",\n        \"linenno\",\n        \"lineno\",\n        \"message\",\n        \"module\",\n        \"msecs\",\n        \"msg\",\n        \"name\",\n        \"pathname\",\n        \"process\",\n        \"processName\",\n        \"relativeCreated\",\n        \"stack\",\n        \"tags\",\n        \"thread\",\n        \"threadName\",\n    )\n)\n\n\ndef _extra_from_record(record):\n    # type: (LogRecord) -> Dict[str, None]\n    return {\n        k: v\n        for k, v in vars(record).items()\n        if k not in COMMON_RECORD_ATTRS and not k.startswith(\"_\")\n    }\n\n\nclass EventHandler(logging.Handler, object):\n    def emit(self, record):\n        # type: (LogRecord) -> Any\n        with capture_internal_exceptions():\n            self.format(record)\n            return self._emit(record)\n\n    def _emit(self, record):\n        # type: (LogRecord) -> None\n        if not _can_record(record):\n            return\n\n        hub = Hub.current\n        if hub.client is None:\n            return\n\n        hint = None  # type: Optional[Dict[str, Any]]\n        client_options = hub.client.options\n\n        # exc_info might be None or (None, None, None)\n        if record.exc_info is not None and record.exc_info[0] is not None:\n            event, hint = event_from_exception(\n                record.exc_info,\n                client_options=client_options,\n                mechanism={\"type\": \"logging\", \"handled\": True},\n            )\n        elif record.exc_info and record.exc_info[0] is None:\n            event = {}\n            hint = None\n            with capture_internal_exceptions():\n                event[\"threads\"] = [\n                    {\n                        \"stacktrace\": current_stacktrace(client_options[\"with_locals\"]),\n                        \"crashed\": False,\n                        \"current\": True,\n                    }\n                ]\n        else:\n            event = {}\n\n        event[\"level\"] = _logging_to_event_level(record.levelname)\n        event[\"logger\"] = record.name\n        event[\"logentry\"] = {\"message\": to_string(record.msg), \"params\": record.args}\n        event[\"extra\"] = _extra_from_record(record)\n\n        hub.capture_event(event, hint=hint)\n\n\n# Legacy name\nSentryHandler = EventHandler\n\n\nclass BreadcrumbHandler(logging.Handler, object):\n    def emit(self, record):\n        # type: (LogRecord) -> Any\n        with capture_internal_exceptions():\n            self.format(record)\n            return self._emit(record)\n\n    def _emit(self, record):\n        # type: (LogRecord) -> None\n        if not _can_record(record):\n            return\n\n        Hub.current.add_breadcrumb(\n            _breadcrumb_from_record(record), hint={\"log_record\": record}\n        )\n", "path": "sentry_sdk/integrations/logging.py"}]}