opened
EvertEt
username_0
We can disable loggers using `ignore_logger` but we cannot re-enable them.

The use case I have is the following code
```python
try:
    blob_service.get_blob_to_path(storage_container, blob, local_path)
except AzureMissingResourceHttpError:
    logging.debug(...)
```
Running this code and running into a `AzureMissingResourceHttpError` error shows up in sentry because `get_blob_to_path` logs an error into its own logger (`azure.storage.common.storageclient`).

Since I found no clean way to filter this in before_send (I thought about setting a flag that we're handling the error ourselves), I would like to disable and re-enable the logger around this call.

Would this be possible (open to a PR?) or is there a better solution?

Thanks
Ability to re-enable loggers in logging integration
issue
created
untitaker
username_1
@username_0 I think "Inbound Filters" in the Sentry UI would be the easiest way to deal with this. You can define a list of globs there that match on error message.

The problem with disabling and re-enabling is that it is generally not a per-thread setting (for a good reason). So if you were to do this from one view (or celery job, you name it), it would have the side effect of disabling the logger on unrelated threads for the same amount of time.

What was the problem with disabling it in `before_send`? If it actually ends up as an error in the Sentry UI, it should generally be possible to do it from there. It's just quite a lot of code, most of the time.

Another hack to completely disable the SDK for a given codeblock (per-thread) is:

```python
with sentry_sdk.Hub(None):
    blob_service...
```
comment
created
EvertEt
username_0
The problem with `before_send` is that `get_blob_to_path` might be called in other places and there we don't want to disable it but I couldn't get that information to check it. I think the hub solution looks great, will try it
comment
created
untitaker
username_1
What useful information is in `azure.storage.common.storageclient` that you don't want to discard? I know very little about the AWS SDK but it seems like for Sentry's purposes every true error ends up as an exception anyway.
comment
created
EvertEt
username_0
It should indeed but as we have had some problems with not all errors being catched, we like to be on the safe side
comment
created
EvertEt
username_0
Using 
```
        with sentry_sdk.Hub(None):
            blob_service.get_blob_to_path(storage_container, blob, local_path)

```
I am getting
```
/usr/lib/python3.7/ctypes/util.py:291: Warning: Integration <class 'sentry_sdk.integrations.stdlib.StdlibIntegration'> attempted to run but it was only enabled on init() but not the client that was bound to the current flow.  Earlier versions of the SDK would consider these integrations enabled but this is no longer the case.
  env={'LC_ALL': 'C', 'LANG': 'C'}) as p:
/usr/lib/python3.7/subprocess.py:873: Warning: Integration <class 'sentry_sdk.integrations.stdlib.StdlibIntegration'> attempted to run but it was only enabled on init() but not the client that was bound to the current flow.  Earlier versions of the SDK would consider these integrations enabled but this is no longer the case.
  self.wait()
/usr/lib/python3.7/http/client.py:1263: Warning: Integration <class 'sentry_sdk.integrations.stdlib.StdlibIntegration'> attempted to run but it was only enabled on init() but not the client that was bound to the current flow.  Earlier versions of the SDK would consider these integrations enabled but this is no longer the case.
  self.putrequest(method, url, **skips)
```
```
/usr/lib/python3.7/logging/__init__.py:1524: Warning: Integration <class 'sentry_sdk.integrations.logging.LoggingIntegration'> attempted to run but it was only enabled on init() but not the client that was bound to the current flow.  Earlier versions of the SDK would consider these integrations enabled but this is no longer the case.
  self.callHandlers(record)
```
What do these errors mean? Thank you
comment
created
untitaker
username_1
It's insignificant and gone in the latest version of the SDK.
comment
created
EvertEt
username_0
Alright thank you. Using `with sentry_sdk.Hub(None):` works perfectly for what I needed, thank you!
comment
closed
EvertEt
username_0
issue